Skip to content

Global Data (Datanode) API

This section describes the endpoint /datanodes with associated resources to create, update and delete data nodes.

The Singular Data Node Architecture is a mechanism to push gobal data into the Singular Cloud where they are available to compositions in an account. Singular Data Nodes fields can be linked to Singular properties in the composer.

POST Create Data Node

Create a data node in your account.

Requires for authentication a Username and Password

Method URL Sample URL
POST /datanodes https://app.singular.live/apiv1/datanodes

REQUEST

NO PARAMETERS

REQUEST BODY

The request body are key/value pairs of properties of the app instance to create.

Parameter Description Required
name name of the new data node yes
folder folder uuid to specify the destination folder for the data node. yes
thumbnail url to an image in png format optional
data:{model} definition of the data model fields in key/value pairs yes
data:{payload} definition of the content or payload of the data node yes

The request body for data:{model} contains an array of field specifications:

Key Description
defaultValue default value of the field
id id of the field
title title is used for the field label in the composer
type type of the field
available field types are: text, textarea, number, json text, image, gradient, color, checkbox, color, button

The request body for data:{payload} specification:

Key:Value Description
id of field:value list of field ids and values

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{
  "name": "New Data Node",
  "folder": "4e867728-b556-4d10-8761-afecf431614b",
  "thumbnail": "images/defaultimage.png",
  "data": {
    "model": {
      "fields": [
        {
          "defaultValue": "Default crawl title",
          "id": "Crawl Title",
          "title": "Crawl Title",
          "type": "text"
        },
        {
          "defaultValue": "Default crawl text",
          "id": "Crawl Text",
          "title": "Crawl Text",
          "type": "text"
        },
        {
          "defaultValue": "10",
          "id": "Crawl Speed",
          "title": "Crawl Speed",
          "type": "number"
        }
      ]
    },
    "payload": {
      "Crawl Title": "Title text here...",
      "Crawl Text": "Crawl text here...",
      "Crawl Speed": "10.0"
    }
  }
}

RESPONSE

STATUS 200 - application/json - Returns full JSON representation of the created data node

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  "user_id": 2290,
  "account_id": 56,
  "tenant_id": null,
  "name": "New Data Node",
  "firebaseUrl": "https://fiery-torch-2122.firebaseio.com/users/2290/dataNodes/-LKDNRsqW3OoLWQkxDg8",
  "fid": "7fc856f3-c91e-42ec-b5bc-dc082abeb905",
  "updated_at": "2018-08-18T18:52:37.319Z",
  "created_at": "2018-08-18T18:52:37.319Z",
  "id": 1234,
  "refId": 1234,
  "type": "datanode"
}

STATUS 401 Returned if authorisation failed.

GET List all Data Nodes

Return a list of all data nodes in an account.

Requires for authentication a Username and Password.

Method URL Sample URL
GET /datanodes https://app.singular.live/apiv1/datanodes

REQUEST

No query parameters

RESPONSE

STATUS 200 - application/json - Returns an array with full JSON representation of all data nodes in an account

EXAMPLE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[
  {
    "id": 1234,
    "account_id": 56,
    "tenant_id": null,
    "user_id": 2290,
    "is_deleted": 0,
    "fid": "7fc856f3-c91e-42ec-b5bc-dc082abeb905",
    "name": "New Data Node",
    "firebaseUrl": "https://fiery-torch-2122.firebaseio.com/users/2290/dataNodes/-LKDNRsqW3OoLWQkxDg8",
    "thumbnail": null,
    "category": null,
    "created_at": "2018-08-18T18:52:37.000Z",
    "updated_at": "2018-08-18T18:52:37.000Z",
    "firestorePath": null,
    "deleted_at": null
  },
  {
    "id": 1232,
    "account_id": 56,
    "tenant_id": null,
    "user_id": 2290,
    "is_deleted": 0,
    "fid": "1492aff6-0235-4fcc-936a-afe84ae49cc2",
    "name": "New Data Node",
    "firebaseUrl": "https://fiery-torch-2122.firebaseio.com/users/2290/dataNodes/-LKDMPexd7eqFOya_fdj",
    "thumbnail": null,
    "category": null,
    "created_at": "2018-08-18T18:48:06.000Z",
    "updated_at": "2018-08-18T18:48:06.000Z",
    "firestorePath": null,
    "deleted_at": null
  }
]

STATUS 401 Returned if authorisation failed.

GET List Data Node Details

Return details for one specific data nodes in an account.

Requires for authentication a Username and Password.

Method URL Sample URL
GET /datanodes/{datanode_id} https://app.singular.live/apiv1/datanodes/1232

REQUEST

QUERY PARAMETERS

Parameter Description Required
{datanode_id} The Id of the data node yes

RESPONSE

STATUS 200 - application/json - Returns the full JSON representation of a data node.

EXAMPLE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{
  "id": 1232,
  "account_id": 56,
  "tenant_id": null,
  "user_id": 2290,
  "is_deleted": 0,
  "fid": "1492aff6-0235-4fcc-936a-afe84ae49cc2",
  "name": "New Data Node",
  "firebaseUrl": "https://fiery-torch-2122.firebaseio.com/users/2290/dataNodes/-LKDMPexd7eqFOya_fdj",
  "thumbnail": null,
  "category": null,
  "created_at": "2018-08-18T18:48:06.000Z",
  "updated_at": "2018-08-18T18:48:06.000Z",
  "firestorePath": null,
  "deleted_at": null
}

STATUS 401 Returned if authorisation failed.

STATUS 404 Returned if data node id undefined or not found.

GET List Data Node Model and Payload

Return details for one specific data nodes in an account.

Requires for authentication a Username and Password.

Method URL Sample URL
GET /datanodes/{datanode_id}/data https://app.singular.live/apiv1/datanodes/1232/data

REQUEST

QUERY PARAMETERS

Parameter Description Required
{datanode_id} The Id of the data node yes

RESPONSE

STATUS 200 - application/json - Returns the full JSON representation of a data node.

EXAMPLE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
  "id": "-LKDMPexd7eqFOya_fdj",
  "model": {
    "fields": [
      {
        "defaultValue": "Default crawl title",
        "id": "Crawl Title",
        "title": "Crawl Title",
        "type": "text"
      },
      {
        "defaultValue": "Default crawl text",
        "id": "Crawl Text",
        "title": "Crawl Text",
        "type": "text"
      },
      {
        "defaultValue": "10",
        "id": "Crawl Speed",
        "title": "Crawl Speed",
        "type": "number"
      }
    ]
  },
  "name": "New Data Node",
  "payload": {
    "Crawl Speed": "10.0",
    "Crawl Text": "Crawl text here...",
    "Crawl Title": "Title text here..."
  },
  "refId": 1232,
  "ts": 1534618086096
}

STATUS 401 Returned if authorisation failed.

STATUS 404 Returned if data node id undefined or not found.

PUT Update Data Node

Update the payload or the model and the payload of a data node.

Requires for authentication a Username and Password

Method URL Sample URL
PUT /datanodes/{datanode_id}/data https://app.singular.live/apiv1/datanodes/1232/data

REQUEST

PARAMETERS

Parameter Description Required
{datanode_id} The Id of the data node yes

REQUEST BODY

Example: Minimal request body to update the payload only

1
2
3
4
5
6
7
{
  "payload": {
    "Crawl Title": "Title text here..",
    "Crawl Text": "Crawl text here..",
    "Crawl Speed": "10.0"
  }
}

Example: Request body to update the model and the payload.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  "model": {
    "fields": [
      {
        "defaultValue": "Default crawl title",
        "id": "Crawl Title",
        "title": "Crawl Title",
        "type": "text"
      },
      {
        "defaultValue": "Default crawl text",
        "id": "Crawl Text",
        "title": "Crawl Text",
        "type": "text"
      },
      {
        "defaultValue": "10",
        "id": "Crawl Speed",
        "title": "Crawl Speed",
        "type": "number"
      }
    ]
  },
  "payload": {
    "Crawl Title": "Title text here...",
    "Crawl Text": "Crawl text here...",
    "Crawl Speed": "10.0"
  }
}

RESPONSE

STATUS 200 - application/json - Returns full JSON representation of the updated data node.

Example: Response for request body updating the payload or model and payload.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
  "model": {
    "fields": [
      {
        "defaultValue": "Default crawl title",
        "id": "Crawl Title",
        "title": "Crawl Title",
        "type": "text"
      },
      {
        "defaultValue": "Default crawl text",
        "id": "Crawl Text",
        "title": "Crawl Text",
        "type": "text"
      },
      {
        "defaultValue": "10",
        "id": "Crawl Speed",
        "title": "Crawl Speed",
        "type": "number"
      }
    ]
  },
  "payload": {
    "Crawl Title": "Title text here..",
    "Crawl Text": "Crawl text here..",
    "Crawl Speed": "10.0"
  },
  "id": "-LKDMPexd7eqFOya_fdj",
  "name": "New Data Node",
  "refId": 1232,
  "ts": 1534624091692
}

STATUS 400 Bad Request: Returned if the body JSON is wrong.

STATUS 401 Returned if authorisation failed.

STATUS 404 Returned if data node id undefined or not found.

PUT Update Data Node Metadata

Update the metadata of a data node.

Requires for authentication a Username and Password

Method URL Sample URL
PUT /datanodes/{datanode_id}/data https://app.singular.live/apiv1/datanodes/1232/metadata

REQUEST

PARAMETERS

Parameter Description Required
{datanode_id} The Id of the data node yes

REQUEST BODY

Example: Updata the name and the category of a data node.

1
2
3
4
{
  "name": "New Name for Data Node",
  "category": "API Demo"
}

RESPONSE

STATUS 200 - application/json - Returns Ok.

STATUS 401 Returned if authorisation failed.

STATUS 404 Returned if data node id undefined or not found.

PATCH Change Data Node Model and Payload

Change and extend the data node model and payload.

Requires for authentication a Username and Password

Method URL Sample URL
PATCH /datanodes/{datanode_id}/data https://app.singular.live/apiv1/datanodes/1234/data

REQUEST

QUERY PARAMETERS

Parameter Description Required
{datanode_id} The Id of the data node yes

REQUEST BODY

The request body has the same structure as used for creating a data node. Refer to Create a Data Node for a detailed description

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
  "model": {
    "fields": [
      {
        "defaultValue": "Breaking News Headline",
        "id": "Breaking News",
        "title": "Breaking News",
        "type": "text"
      }
    ]
  },
  "payload": {
    "Breaking News": "Latest News from around the World..."
  }
}

RESPONSE

STATUS 200 - application/json - Returns full JSON representation of the updated data node

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
  "id": "-LKDNRsqW3OoLWQkxDg8",
  "model": {
    "fields": [
      {
        "defaultValue": "Default crawl title",
        "id": "Crawl Title",
        "title": "Crawl Title",
        "type": "text"
      },
      {
        "defaultValue": "Default crawl text",
        "id": "Crawl Text",
        "title": "Crawl Text",
        "type": "text"
      },
      {
        "defaultValue": "10",
        "id": "Crawl Speed",
        "title": "Crawl Speed",
        "type": "number"
      },
      {
        "defaultValue": "Breaking News Headline",
        "id": "Breaking News",
        "title": "Breaking News",
        "type": "text"
      },
      {
        "id": "Breaking News",
        "type": "text",
        "title": "Breaking News",
        "defaultValue": "Latest News from around the World..."
      }
    ]
  },
  "name": "New Data Node",
  "payload": {
    "Crawl Speed": "10.0",
    "Crawl Text": "Crawl text here.....",
    "Crawl Title": "Title text here.....",
    "Breaking News": "Latest News from around the World..."
  },
  "refId": 1234,
  "ts": 1534670990978
}

STATUS 401 Returned if authorisation failed.

STATUS 404 Returned if data node id undefined or not found.

DELETE Delete Data Node

Delete a data node in your account.

Requires for authentication a Username and Password

Method URL Sample URL
DELETE /datanodes/{datanode_id} https://app.singular.live/apiv1/datanodes/12345

REQUEST

QUERY PARAMETERS

Parameter Description Required
{datanode_id} The Id of the data node yes

RESPONSE

STATUS 200 - application/json - Returns Ok

STATUS 401 Returned if authorisation failed.

STATUS 404 Returned if the data node id undefined or not found.