Developers
Search…
API Overview

This is a socket-based interactive api based on the Socket.io library.

Overview

In order to connect, a valid api_token query parameter must be specified. All tokens are restricted by Origin and therefore a valid HTTP_ORIGIN header is expected. Feel free to get started with http://localhost:3000 as an origin and a Demo Key: Demo.ukEVQp6L5vfgxcz4sBke7XvS873GMYHy.
1
let io_options = {transports: ['websocket'], query: {api_token: 'YOUR API TOKEN'}};
2
socket = io('wss://api.zerion.io', io_options);
Copied!

Actions

There are three supported types of messages:
  • get - requests data, returns a single response and does not emit continuous messages
  • subscribe - returns a single response (the same as get) + creates a subscription
  • unsubscribe - deletes the subscription

Request

Each request has the following structure:
1
[
2
"{action}",
3
{
4
"scope": ["scope1", "scope2"],
5
"payload": {
6
"parameter1": "value1",
7
"parameter2": "value2"
8
}
9
}
10
]
Copied!

Response

1
[
2
"received {namespace} {model}",
3
{
4
"meta": {
5
"status": "ok",
6
"request parameter1": "value1",
7
"request parameter2": "value2"
8
},
9
"payload": {
10
"{scope}": "__result__"
11
}
12
}
13
]
Copied!

Change

1
[
2
"changed|appended|removed {namespace} {model}",
3
{
4
"meta": {
5
"subscription parameter1": "value1",
6
"subscription parameter2": "value2"
7
},
8
"payload": {
9
// changed model
10
}
11
}
12
]
Copied!