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).
Interface for Querying Subscribed Messages

Interface for Querying Subscribed Messages

Function

This interface is used for querying subscribed messages of a connected third-party system based on the OpenAPI account of the system.

URI

/rest/openapi/notification/subscribeinfo

Access Method

GET

Parameter Description

Parameter

Mandatory/Optional

Location

Value Type

Description

openid

Mandatory

Request message header

String

Indicates the session identifier, which is used for open API authorization.

NOTE:

The third-party system obtains this parameter by invoking the login interface of the security management module.

userid

Mandatory

Parameter list

String

Indicates the OpenAPI account name.

NOTE:

This parameter is the same as the userid sent from the third-party system when it invokes the login interface of the security management module.

Result

Field

Value Type

Description

code

int

Indicates the returned code. Available options are as follows:

  • 0: Successful
  • Other values: Failed

data

String

Indicates all the messages subscribed by the OpenAPI account.

description

String

Describes the invocation result.

Precautions

In requests that use the application/x-www-form-urlencoded MIME type, spaces are encoded as plus signs (+), and plus signs are encoded as %2B.

Invocation Example

Data Segment

Value

Request URL

GET https://eSightIP:port/rest/openapi/notification/subscribeinfo?userid=openapiUser. HTTP/1.1

Request header

openid: 775c47f9-9a1b-43f9-a24b-2c3db1a55622;

Request entity

N/A

Response entity

{"code":0,"data":null,"description":"Operation success."}

Usage Example

package com.huawei.nms.openapi.demo.notification;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.HttpResponse;
import org.apache.http.message.BasicNameValuePair;

import com.huawei.nms.openapi.demo.global.GlobalVar;
import com.huawei.nms.openapi.demo.global.NewHttpsAccess;
import com.huawei.nms.openapi.demo.sm.Login;

public class GetSubscribeinfoTest {

  public static void main(String[] args) throws Exception {
    Login.login();
    get();
  }

public static void get() throws Exception {
        //set the URL and method
        final String openidURL = "/rest/openapi/notification/subscribeinfo";
        final String method = "GET";
        
        List<BasicNameValuePair> headers = new ArrayList<BasicNameValuePair>();
        headers.add(new BasicNameValuePair("openid",GlobalVar.globalOpenid));

        //set parameters
        final List<BasicNameValuePair> parameters = new ArrayList<BasicNameValuePair>();
        parameters.add(new BasicNameValuePair("userid",GlobalVar.GLOBAL_USERNAME));
        
        //send the request
        final HttpResponse response = NewHttpsAccess.access(GlobalVar.GLOBAL_IP,
                GlobalVar.GLOBAL_PORT,
                openidURL,
                method,
                headers,
                parameters);

        //get the result
        final String ret = NewHttpsAccess.getResult(response);
        System.out.println(ret);
 }
}

The returned result is as follows:

{
  "code":0,
  "data":[{"systemID":"NMSinfo1","resourceURI":"openapiInternal/openapi/notification/common/nedevice","locationSite":"","url":"http://127.0.0.2:8080/device","filterInfos":"","isSuspended":"0","userId":"openapi","openID":"127.0.0.1"}],
  "description":"Operation success"
}
Translation
Download
Updated: 2019-10-30

Document ID: EDOC1100044386

Views: 15863

Downloads: 83

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