Developer Guide

EdgeGalleryBusiness Development Guidance

Northbound Interface Calling Guide

EdgeGallerySupport third-party business system invocation through northbound interface gatewayEdgeGallerybusiness interface。The calling process is shown in the following figure:

Northbound interface call process

Northbound interface callendpoint

Currently byWebsiteGatewayto assume the responsibility of the northbound interface gateway,Specifically byWebsiteGatewayThe front-end of each business platform that is running is responsible for。

So the northbound interface callsendpointYou can use the front-end of any business platformendpoint。as follows:

平台 endpoint 说明
EdgeGallery融合前端 https://{PORTAL_IP}:30095 推荐使用该endpoint
AppStore平台前端 https://{PORTAL_IP}:30091 --
Developer平台前端 https://{PORTAL_IP}:30092 --
Mecm平台前端 https://{PORTAL_IP}:30093 --
Atp平台前端 https://{PORTAL_IP}:30094 --

ObtainXSRF-TOKEN

Get in the callAccessTokenBefore the interface and the business interface of each platform,need to getXSRF-TOKEN。

Resource URI: /
Method: GET

Example request:

GET https://x.x.x.x:30095/

Example response:

response 200 OK

响应的Cookie中即包含XSRF-TOKEN,请获取它。
后续所有的接口调用中都需要通过请求头X-XSRF-TOKEN传递。

ObtainAccessToken

Resource URI: /mec-usermgmt/v1/accesstoken
Method: POST

Name

Definition

Type

Required

Describe

X-XSRF-TOKEN

XSRF-TOKEN

header

Yes

userFlag

login credentials(username/Mail/Phone number)

body

Yes

password

password

body

Yes

Example request:

https://x.x.x.x:30095/mec-usermgmt/v1/accesstoken -H "X-XSRF-TOKEN: xxxx"
{
  "userFlag": "",
  "password": ""
}

Example response:

response 200 OK
{
  "accessToken": "eyJhbGciOiJSUzI1NiIsInR5xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

后续所有的业务接口调用都需要通过请求头X-ACCESS-TOKEN传递这里的accessToken值。

response 400 Bad Request
{
  "code": 70xxx,
  "message": ""
}

response 401 Unauthorized
{
  "code": 70xxx,
  "message": ""
}

call business interface

Business interfaces provided by each platform,Refer to the interface documentation of each module。

Northbound service interfaceURLFormat

When calling the business interface of each platform through the northbound interface,URLCalled in the following format:

https://x.x.x.x:30095/{urlPrefix}/{业务接口自身的URL}

inurlPrefixis the routing prefix defined by each platform in the gateway,The definitions are shown in the table below:

平台 urlPrefix
AppStore mec-appstore
Developer mec-developer
Mecm-Inventory mecm-inventory
Mecm-APPO mecm-appo
Mecm-APM mecm-apm
ATP mec-atp

Northbound service interface request header

When calling the business interface of each platform through the northbound interface,The following request headers need to be passed:

Name Definition
X-XSRF-TOKEN XSRF-TOKEN
X-ACCESS-TOKEN ACCESS-TOKEN

Northbound Service API Calling Example

AppStoreThe platform provides an interface to get the application list: GET /mec/appstore/v1/apps

northbound call:

GET https://x.x.x.x:30095/mec-appstore/mec/appstore/v1/apps -H "X-XSRF-TOKEN: xxxx" -H "X-ACCESS-TOKEN: xxxx"

third partyIAMDocking development guidance

EdgeGallerySupport the use of third-party dockingIAMaccount system。

in deploymentEdgeGalleryPlease refer to:Offline Installation GuideThe instructions in Turn on third-partyIAMenable switch。

For third partiesIAMaccount system,Need to implement the following interface:

接口名称 URL Method Request Response Response Status
登录 /iam/users/login POST {
"userFlag": "xxxx",//用户登录凭证(用户名/邮箱地址)
"password": "xxx"//登录密码
}
{
"userId": "", //用户ID
"userName": "", //用户名
"mailAddress": "", //邮箱地址(可选)
"userRole": "", //用户角色(ADMIN:管理员 TENANT:租户)
}
200:登录成功,返回用户信息
401:认证失败