No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

eSight V300R010C00SPC200, 300, and 500 Self-Service Integration Guide 10

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Quick Start

Quick Start

This chapter mainly introduces the elementary knowledge of Open APIs, and helps you quickly carry out Open API development.

What Is Open API?

Open API is a REST-based open interface provided by the eSight. REST is short for Representational State Transfer. Third-party developers can use Open API interfaces to grant permission to users to access eSight resources, for example, security management, element access management, and fault management and so on.

Application Scenarios

More and more technicians dedicate themselves in network application development and develop application programming interfaces (APIs) that can be shared by multiple Internet vendors as the Internet diversifies and skills requirements are lowered. In the coming years, APIs will burst. Enterprise website contents will be rich and the websites can interact properly with visitors.

Open APIs, based on open authentication, use the asymmetric encryption technique to authenticate users. Users use returned open IDs to access resources. Open APIs allow different platforms, enterprises, and entities to share data.

An open API is a common application on service websites. Website service providers encapsulate their website services and open them using APIs for third-party developers. This action is opening website APIs. Open APIs are created for jointing information and for business reasons.

Many Internet companies provide open APIs for third-party developers. After being authorized, they can use massive resources of the data cells. Data is limited but creativity is infinite. Massive data can be used to complete infinite creativity.

Open API Features

The open APIs provide the following features:

  1. Provides standard integration solutions for quick integration with third-party systems.
  2. Require authorization and support only HTTPS access.
  3. Use JavaScript Object Notation (JSON) for data exchange. Its format is simple and JSON data is easy to read and write. Compared with the XML format, the JSON format consumes less network traffic.

Networking Constraints

If the eSight interconnects with only one northbound third-party system, to ensure that KPI, resource, and alarm data is reported completely, users must plan 10 Mbit/s bandwidth separately for data reporting.

If the eSight interconnects with ten northbound third-party systems, users must plan 100 Mbit/s bandwidth separately for data reporting.

What Is REST?

REST is a design and development method for network applications. It decreases development complexity and improves system scalability.

REST is built around resources, each of which has a unique uniform resource identifier (URI), for example: /rest/openapi/netype.

REST uses four operations to access resources: POST, GET, PUT, and DELETE.

  • POST: creates a resource.
  • GET: queries resources.
  • PUT: updates a resource.
  • DELETE: deletes a resource.

The eSight provides external services using URIs. Users obtain eSight resources through URIs and obtain services.

What Is JSON?

JSON is a lightweight data-interchange format.

JSON has the following two structures:

  • Object: Braces ({}) hold objects, for example, {key1: value1, key2: value2, ...}. You can access data using Object.key.
  • Array: Brackets ([]) hold arrays, for example, [element1, element2, ...]. You can access data using Object[index]. The index starts from 0.

JSON strings are more concise compared with XML strings and decrease network traffic.

The following code shows how to access JSON string data.

<script type="text/javascript">
   var resultInfo = {"data":{"total":7,"key_2":2,"key_1":5}, 
                     "code":0, 
                     "description":"Success to get alarmcount." };
   //Access the value of key_1.
   var key_1 = resultInfo.data.key_1;
</script>

What Is HTTP?

Hypertext Transfer Protocol (HTTP) is a widely used network protocol in the Internet.

HTTP was originally developed to provide a method for publishing and receiving Hypertext Markup Language (HTML) pages.

HTTP or HTTPS resources are identified by uniform resource identifiers (URLs).

Hypertext Transfer Protocol over Secure Socket Layer (HTTPS) is a secure HTTP channel. HTTPS is based on SSL and therefore transmission contents are encrypted using SSL to ensure data security.

HTTP Request Message

The structure of the HTTP request message format is as follows:

  • Request line, for example, GET /images/logo.gif HTTP/1.1, which indicates that the desired object is the logo.gif file in /images.
  • Request headers, for example, Accept-Language: en.
  • Empty line.
  • Message body.

HTTP Request Method

HTTP/1.1 defines the following eight methods (actions) for various operations on specified resources:

  • OPTIONS: Returns the HTTP methods that the server supports for the specified resource. This can be used to check the functionality of a web server by requesting '*' instead of a specific resource.
  • HEAD: HEAD: Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content.
  • GET: Requests a representation of the specified resource. Requests using GET should only retrieve data and should have no side effects. Web applications must follow this principle.
  • POST: Submits data (for example, forms or files) to a specified resource and requests the server for processing. Data is enclosed in the request. The request may create a resource or modify an existing resource, or both.
  • PUT: Uploads the latest content to a specified resource location.
  • DELETE: Asks the server to delete the resource identified in the Request-URI.
  • TRACE: Echoes back the request received by the server. This is used for testing or diagnosis.
  • CONNECT: Converts the request connection to a tunnel. This method is specified in HTTP/1.1. This usually is to facilitate SSL-encrypted communication through an unencrypted HTTP proxy.

Methods are case-sensitive. The server returns the status code 405 (Method Not Allowed) if the method specified in a request is not allowed for the resource identified by the request. The server returns the status code 501 (Not Implemented) if the server does not support the functionality required to fulfill the request.

HTTP Status Code

In an HTTP response message, the first line is the status line, which contains the HTTP version, three-digit status code, and status description in sequence. The contents are separated by spaces.

The first digit of a status code indicates the response class.

  • Informational 1xx: This class of status codes indicates that the request was received by the server and subsequent processing continues.
  • Successful 2xx: This class of status codes indicates that the client's request was successfully received, understood, and accepted.
  • Redirection 3xx: This class of status codes indicates that further actions need to be taken by the user agent to fulfill the request.
  • Client error 4xx: This class of status codes indicates that the request contain syntactic errors or cannot be executed.

Server error 5xx: This class of status codes indicates that server encountered an unexpected condition which prevented it from fulfilling the request.

HTTP Request Example

The following uses a session between an HTTP client and server as an example. This session runs on www.google.com and the service port number is 80.

Client request:

GET / HTTP/1.1   
Host:www.google.com  

(The first line specifies the method, resource path, and protocol version. The second line is a required header for HTTP 1.1 and the header specifies a server.)

Server response:

HTTP/1.1 200 OK  
Content-Length: 3059  
Server: GWS/2.0  
Date: Sat, 11 Jan 2003 02:44:04 GMT  
Content-Type: text/html  
Cache-control: private  
Set-Cookie: PREF=ID=73d4aef52e57bae9:TM=1042253044:LM=1042253044:S=SMCc_HRPCQiqy  X9j; expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com  
Connection: keep-alive  
Translation
Download
Updated: 2019-10-30

Document ID: EDOC1100044386

Views: 17280

Downloads: 86

Average rating:
This Document Applies to these Products
Related Version
Related Documents
Share
Previous Next