Developer Guide

EdgeGallery业务开发指导

Northbound Interface

EdgeGallery allows third-party business systems to utilize the inner apis by calling the external apis (Northbound Interface Gateway). The calling process is explained in the following figure:

Northbound API call process

Use Northbound Interface to Call Endpoints

Recently, project WebsiteGateway is responsible for the external api gateway. Specifically, this job is done by the front-end of each business platform running through WebsiteGateway. Therefore, the endpoint called by the external api can utilize business platform front-end endpoints. As follows:

Platform

endpoint

instruction

EdgeGallery Fusion Frontend

https://{PORTAL_IP}:30095

It is recommended to use this endpoint

AppStore Front End

https://{PORTAL_IP}:30091

Developer Front End

https://{PORTAL_IP}:30092

Mecm Front End

https://{PORTAL_IP}:30093

Atp Front End

https://{PORTAL_IP}:30094

Get XSRF-TOKEN

You need to obtain the XSRF-TOKEN before you call Get-Access-Token Api or partner API of MECM, AppStore, Developer…

Resource URI: /
Method: GET

Example request:

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

Example response:

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

Get AccessToken

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

Name

Definition

Type

Required

Describe

X-XSRF-TOKEN

XSRF-TOKEN

header

Yes

userFlag

Login credentials (username/email/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
{
  "userId": "xxxxx",
  "accessToken": "eyJhbGciOiJSUzI1NiIsInR5xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

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

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

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

Call API

For details of interfaces provided by each platform, please go to PROJECTS from navigation bar.

URL format of Northbound Service API

When northbound interface is used to invoke api of each platform(MECM, AppStore, Developer…), make sure the URL is in compliance with the following format.

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

The urlPrefix is the routing prefix defined by each platform in the gateway, as shown in the following table:

Platform

urlPrefix

AppStore

mec-appstore

Developer

mec-developer

Mecm-Inventory

mecm-inventory

Mecm-APP

mecm-appo

Mecm-APM

mecm-apm

ATP

mec-atp

Request Header of Northbound Service API

When northbound interface is used to invoke api of each platform(MECM, AppStore, Developer…), the following request headers is required.

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

Example of Calling Northbound Service API

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

Call northbound api:

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

Developer Guide for Third-party IAM

EdgeGallery supports the use of third-party IAM account systems.

When deploying EdgeGallery, please refer to: Offline Installation Guide to enable the third-party IAM enable switch.

For the third-party IAM account system, the following interfaces need to be implemented:

interface name

URL

请求方法

Request

Response

Response Status

Log in

/iam/users/login

POST

{
“userFlag”: “xxxx”,//User login credentials (username/email address)
“password”: “xxx”//Login password
}

{
“userId”: “”, //User ID
“userName”: “”, //User Name
“mailAddress”: “” , //Email address (optional)
“userRole”: “”, //User role (ADMIN: Admin TENANT: Tenant)
}

200: Login successful, return user information
401: Authentication failed