Overall
caution
Local API is only available for Local Hub
SVR_URL: http://{Your Local Hub IP Address}:1080
ClientId and ClientSecret are obtained in YoLink APP > Local Hub > Local Network > Integrations > Local API
HTTP API
Post /open/yolink/v2/api
Request Header
Params | Value | Description |
---|---|---|
Content-Type | application/json | JSON Formatted |
Authorization | Bearer Token <Necessary> | Access Token |
Request Body
JSON of BDDP
Response Body
JSON of BUDP
You can obtain access token through the following token interface (refresh_token and expires_in included too)
tip
It's recommend that confirm the access_token is not expired before calling the API with access_token. It's also recommend using refresh_token to get a new access_token in preference
MQTT API
Host: ${Local Hub IP Address}, Port: 18080
Auth
Item | Value |
---|---|
Username | ${ClientId} |
Password | ${ClientSecret or AccessToken} |
Client ID | General Unique UUID |
Topic ylsubnet/${Sub-Net Id}/** is authorized to publish and subscribe
tip
You can get Sub-Net Id in YoLink App ([Local Hub] -> [Local Network] -> [General]).
Topic | Desc |
---|---|
ylsubnet/${Sub-Net Id}/+/report | Device's Event(like: StatusChange,Alert,Report), will be reported to this channel; |
ylsubnet/${Sub-Net Id}/**/request | Pub BDDP |
ylsubnet/${Sub-Net Id}/**/response | Sub BUDP |
OAuth2.0
Item | Value |
---|---|
Token URL | ${SVR_URL}/open/yolink/token |
//Get access token
curl -X POST -d "grant_type=client_credentials&client_id=${ClientId}&client_secret=${ClientSecret}" ${SVR_URL}/open/yolink/token
//Get access token by refresh_token
curl -X POST -d "grant_type=refresh_token&client_id=${ClientId}&refresh_token=${Refresh Token}" ${SVR_URL}/open/yolink/token