Create application
Creates an application for the same owner as the application of the current connection and issues a low access level token for it. With the app_id and the token from the response you can connect on behalf of the new application right away, and with the app_eui you can create devices in it using create_device_req. The new application delivers data via WebSocket.
Request and response: create_application_req → create_application_resp.
Access: high access level token only. With a low access level token the server responds with error 1.
Request
Fields not marked as required may be omitted.
| Field | Type | Description |
|---|---|---|
cmd | string | create_application_req |
operation_id | string | Any string; the server returns it in the response to match the request and the response |
appName | string | Required. Application name. Uniqueness is not checked |
{
"cmd": "create_application_req",
"operation_id": "abc",
"appName": "testApp"
}
Response
| Field | Type | Description |
|---|---|---|
cmd | string | create_application_resp |
operation_id | string | Value from the request |
status | uint8 | 1 — the application is created, 2 — error |
app_id | string | Application identifier, 8 hex characters. Needed to connect |
app_eui | string | Application AppEUI, 16 hex characters |
token | string | Low access level token, 22 characters: Latin letters and digits |
error_code, error_text | uint8, string | Only on error, see below |
{
"cmd": "create_application_resp",
"operation_id": "abc",
"status": 1,
"app_id": "358098F3",
"app_eui": "258BD226017CBF01",
"token": "737x6WuNdSBC4VFWhuyHHz"
}
Errors
error_code | error_text | What happened |
|---|---|---|
| 1 | Unauthorized access | The request came with a low access level token |
| 2 | Required field is not filled | appName is missing or empty |
| 3 | Unexpected error | The server could not store the application or the token. If the token was not stored, the application already exists — check with get_applications_req |
| 0 | — | Internal server error — retry later |
Good to know
- A retry creates a second application. The name does not have to be unique, so a request repeated after a connection drop creates one more application. Check the list with
get_applications_reqbefore retrying. - The token from the response is a low access level token: it gives access to the devices of its application but cannot be used to create devices or applications.
See also
get_applications_req— list of applications and their tokens.delete_application_req— delete an application.