Add a data source

POST/homes/{homeId}/dataSources

Base URL: https://api.tinkermode.com

Add a data source to a home. Data sources must be associated with Data Source Catalog ID which is allowed by the system administrator.

Authentication

Send an Authorization header of the form ModeCloud <AUTH_CODE>.

Must contain a user, service account, or project API key.

Path parameters

NameTypeRequiredConstraintsDescription
homeIdintegerYesThe unique ID for a specified home.

Request body

Content type: application/json

PropertyTypeRequiredConstraintsDescription
attributesobjectNoOptional/informational key-values associated with device. Can be used to store the serial number, for example.
catalogIdstringYesread-only (server-generated)Data Source Catalog ID.
createdAtstringNoread-only (server-generated); format: date-timeTimestamp of data source creation.
dataTypesarray<string>Noread-only (server-generated)Data types of the data source. It must be one of the supported data types: metrics, locations, and customLog. These values are annotations for filtering data sources in data route panel.
deliveryPolicystringNoone of: buffered, unbufferedThe deliveryPolicy field of the dataSource object configures the data transmission method utilized by the Gateway. When the deliveryPolicy is set to buffered, the Gateway ensures guaranteed delivery of data. In the absence of this setting, the Gateway operates in a best effort delivery, which does not guarantee delivery but minimizes delays. This field is enabled only when the dataSource object includes a deviceId. If this field is not specified, the system defaults to the buffered setting.
deviceIdnumberNoThe device ID is associated with the catalogId and sourceId. The specified device ID must be attached to a home. The device ID is optional when the sourceId is a data source of integration module.
enabledbooleanNoThe flag indicates whether the data source is enabled.
homeIdintegerYesread-only (server-generated)Home that this data source belongs to.
imageDataobjectNoMetadata used for the uploaded image of the data source.
Properties of imageData
PropertyTypeRequiredConstraintsDescription
fileNamestringNoFileName represents the name of the file uploaded.
urlstringNoA temporary signed URL for file download.
multibooleanNoread-only (server-generated)The flag indicates whether the data source can attach to the multiple routings.
namestringYesDisplay name of data source.
projectIdintegerYesread-only (server-generated)Project that this data source belongs to.
sourceIdstringYesread-only (server-generated)Unique Data Source ID.
updatedAtstringNoread-only (server-generated); format: date-timeTimestamp of the last update on the data source.

Request example

{
  "attributes": {
    "manufacturer": "MODE, inc.",
    "serial": "0000001234"
  },
  "catalogId": "bu01",
  "createdAt": "2021-09-02T22:19:39Z",
  "dataType": "metrics",
  "deviceId": 1234,
  "enabled": true,
  "homeId": 1234,
  "imageData": {
    "fileName": "thumbnail.png",
    "url": "https://example.com/images/thumbnail.png"
  },
  "multi": false,
  "name": "Sensor 1",
  "projectId": 1234,
  "sourceId": "a3b2ac399abc",
  "updatedAt": "2021-09-02T22:19:39Z"
}

Responses

201 Successfully created a new data source.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
attributesobjectNoOptional/informational key-values associated with device. Can be used to store the serial number, for example.
catalogIdstringYesread-only (server-generated)Data Source Catalog ID.
createdAtstringNoread-only (server-generated); format: date-timeTimestamp of data source creation.
dataTypesarray<string>Noread-only (server-generated)Data types of the data source. It must be one of the supported data types: metrics, locations, and customLog. These values are annotations for filtering data sources in data route panel.
deliveryPolicystringNoone of: buffered, unbufferedThe deliveryPolicy field of the dataSource object configures the data transmission method utilized by the Gateway. When the deliveryPolicy is set to buffered, the Gateway ensures guaranteed delivery of data. In the absence of this setting, the Gateway operates in a best effort delivery, which does not guarantee delivery but minimizes delays. This field is enabled only when the dataSource object includes a deviceId. If this field is not specified, the system defaults to the buffered setting.
deviceIdnumberNoThe device ID is associated with the catalogId and sourceId. The specified device ID must be attached to a home. The device ID is optional when the sourceId is a data source of integration module.
enabledbooleanNoThe flag indicates whether the data source is enabled.
homeIdintegerYesread-only (server-generated)Home that this data source belongs to.
imageDataobjectNoMetadata used for the uploaded image of the data source.
Properties of imageData
PropertyTypeRequiredConstraintsDescription
fileNamestringNoFileName represents the name of the file uploaded.
urlstringNoA temporary signed URL for file download.
multibooleanNoread-only (server-generated)The flag indicates whether the data source can attach to the multiple routings.
namestringYesDisplay name of data source.
projectIdintegerYesread-only (server-generated)Project that this data source belongs to.
sourceIdstringYesread-only (server-generated)Unique Data Source ID.
updatedAtstringNoread-only (server-generated); format: date-timeTimestamp of the last update on the data source.

Response example

{
  "attributes": {
    "manufacturer": "MODE, inc.",
    "serial": "0000001234"
  },
  "catalogId": "bu01",
  "createdAt": "2021-09-02T22:19:39Z",
  "dataType": "metrics",
  "deviceId": 1234,
  "enabled": true,
  "homeId": 1234,
  "imageData": {
    "fileName": "thumbnail.png",
    "url": "https://example.com/images/thumbnail.png"
  },
  "multi": false,
  "name": "Sensor 1",
  "projectId": 1234,
  "sourceId": "a3b2ac399abc",
  "updatedAt": "2021-09-02T22:19:39Z"
}

401 Authorization is required to access this resource.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

403 Request failed because of invalid data or denied permission.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

429 Request failed because of rate limit.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

500 An unexpected error has occurred.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

503 The service is temporarily unavailable.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.