Back to top

SNAP Thing Services API

SNAP Thing Services API Version 1.7.0

Account

Handles requests for the /changePassword resource path

Update password for currently authenticated user
POST/api/v1/changePassword

Password complexity rules are enforced when changing the user’s password; the new password must be at least 8 characters long and include a combination of lowercase and uppercase letters, numbers, and symbols.

Example URI

POST /api/v1/changePassword
Request
HideShow
Body
{
  "new": "yourNewPassword1#",
  "old": "yourOldPassword"
}
Schema
{
  "required": [
    "old",
    "new"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "new": {
      "description": "New password",
      "type": "string",
      "pattern": "^(?=.*[0-9])(?=.*[!@#$%^&*_\\-])(?=.*?[a-z])(?=.*?[A-Z])[a-zA-Z0-9!@#$%^&*_\\-]{8,}$",
      "pattern_description": "Password must be at least 8 characters and include a combination of lowercase and uppercase letters, numbers, and symbols."
    },
    "old": {
      "description": "Old password",
      "type": "string"
    }
  },
  "description": "A device",
  "title": "Update device",
  "type": "object"
}
Response  200
HideShow

Successfully updated password.

Body
{
  "data": "Successfully changed password"
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "string"
    }
  }
}
Response  400
HideShow

The password could not be changed for any number of reasons (e.g. the old password was incorrect, or the new password does not meet the complexity requirements). The message property of the response should indicate the reason for the failure.

Body
{
  "error": {
    "message": {
      "new": "Password must be at least 8 characters and include a combination of lowercase and uppercase letters, numbers, and symbols."
    }
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "message": {
        "type": "string"
      }
    }
  }
}

Actuation

Actuation Config api handler to toggle actuation

Used to get the actuation config status
GET/api/v1/actuation/config

Example URI

GET /api/v1/actuation/config
Response  200
HideShow

actuation enabled status

Body
{
  "data": {
    "isActuationEnabled": true
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "isActuationEnabled": {
          "description": "true or false",
          "type": "boolean"
        }
      }
    }
  }
}

Used to toggle actuation request
POST/api/v1/actuation/config

Example URI

POST /api/v1/actuation/config
Request
HideShow
Body
{
  "isActuationEnabled": false
}
Schema
{
  "required": [
    "isActuationEnabled"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "isActuationEnabled": {
      "description": "True or False",
      "type": "boolean"
    }
  },
  "description": "Toggle Actuation for devices",
  "title": "Toggle Actuation for devices",
  "type": "object"
}
Response  200
HideShow

actuation enabled status

Body
{
  "data": {
    "isActuationEnabled": true
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "isActuationEnabled": {
          "description": "true or false",
          "type": "boolean"
        }
      }
    }
  }
}

Actuation api handler

Get all actuation results
GET/api/v1/actuation/requests

Example URI

GET /api/v1/actuation/requests
Response  200
HideShow

List all actuation results.

Body
{
  "data": [
    {
      "parameters": [
        256
      ],
      "id": "6f992502-33f0-47d4-a01e-973593e1915d",
      "deviceTypes": [],
      "href": "https://localhost:3000/api/v1/actuation/requests/6f992502-33f0-47d4-a01e-973593e1915d",
      "finishedAt": "2017-01-12T08:50:21.846736",
      "function": "light_level",
      "devices": [
        "098231",
        "09a1b4"
      ],
      "results": [
        {
          "result": "success",
          "address": "098231"
        },
        {
          "result": "failure",
          "address": "09a1b4"
        }
      ]
    },
    {
      "parameters": [],
      "id": "7r592502-33f0-47d4-a01e-973593e1915d",
      "deviceTypes": [
        "devicetype1"
      ],
      "href": "https://localhost:3000/api/v1/actuation/requests/7r592502-33f0-47d4-a01e-973593e1915d",
      "finishedAt": "2017-01-10T08:50:21.846736",
      "function": "actuate_me",
      "devices": [],
      "results": [
        {
          "result": "success",
          "address": "098231"
        }
      ]
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "type": "object",
        "properties": {
          "parameters": {
            "items": {
              "description": "List of parameters",
              "anyOf": [
                {
                  "type": [
                    "string",
                    "boolean",
                    "null",
                    "integer"
                  ]
                }
              ]
            },
            "type": "array"
          },
          "id": {
            "description": "Unique identifier for this actuation",
            "type": "string"
          },
          "deviceTypes": {
            "items": {
              "description": "List of name of device type",
              "type": "string"
            },
            "type": "array"
          },
          "href": {
            "description": "URI for this actuation result",
            "type": "string"
          },
          "finishedAt": {
            "description": "Time at which actuation finished",
            "type": "string"
          },
          "function": {
            "description": "Function Name",
            "type": "string"
          },
          "devices": {
            "items": {
              "description": "List of device MAC addresses",
              "type": "string"
            },
            "type": "array"
          },
          "results": {
            "description": "Result of actuation request",
            "type": "string"
          },
          "createdAt": {
            "description": "Time at which actuation started",
            "type": "string"
          }
        }
      },
      "type": "array"
    }
  }
}

Creates new actuation request
POST/api/v1/actuation/requests

Example URI

POST /api/v1/actuation/requests
Request
HideShow
Body
{
  "parameters": [
    "<stringval>",
    1,
    null,
    true
  ],
  "function": "actuate_me",
  "deviceTypes": [
    "thesedevices",
    "thosedevices"
  ],
  "devices": [
    "0600a3",
    "0833a4",
    "0534fe"
  ]
}
Schema
{
  "required": [
    "function"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "parameters": {
      "items": {
        "anyOf": [
          {
            "type": [
              "string",
              "boolean",
              "null",
              "integer"
            ]
          }
        ]
      },
      "type": "array"
    },
    "function": {
      "description": "SNAPpy script function",
      "type": "string",
      "pattern": "^[a-zA-Z]\\w*$",
      "pattern_description": "Actuation functions must be valid public SNAPpy functions. (ex: 'data', 'actuate_2B')"
    },
    "deviceTypes": {
      "items": {
        "description": "List of types of device. This must exist in the database already.",
        "type": "string"
      },
      "type": "array"
    },
    "devices": {
      "items": {
        "description": "SNAP MAC address",
        "type": "string",
        "pattern": "^(00[.:]?1[cC][.:]?2[cC][.:]?[0-9a-fA-F]{2}[.:]?[0-9a-fA-F]{2}[.:]?)?([0-9a-fA-F][.:]?){5}[0-9a-fA-F]$",
        "pattern_description": "A valid SNAP Address must be a hex value of at least 6 digits with optional period or colon delimiters (ex:\"a18ca9\", \"04:3E:82\")."
      },
      "type": "array"
    }
  },
  "description": "Actuate devices",
  "title": "Actuate devices",
  "type": "object"
}
Response  202
HideShow
Headers
Location: https://localhost:3000/api/v1/tasks/83f4e242-e89d-407b-95e5-a5a603427217
Response  400
HideShow

At least one device address required

Body
{
  "error": {
    "message": "At least one device address required"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  400
HideShow

Parameter string should be base64 encoded

Body
{
  "error": {
    "message": "Parameter string should be base64 encoded"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  400
HideShow

Combined size of function name and parameter list exceeds maximum packet size

Body
{
  "error": {
    "message": "Combined size of function name and parameter list exceeds maximum packet size"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  400
HideShow

If actuation is unlicensed, an actuation request which targets multiple devices will not be sent

Body
{
  "error": {
    "message": "Your license only permits actuation of one device at a time. Please contact your sales representative to discuss upgrading your license to support multiple simultaneous actuations."
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Actuation result handler

Get a single actuation result
GET/api/v1/actuation/requests/{actuationId}

Example URI

GET /api/v1/actuation/requests/1
URI Parameters
HideShow
actuationId
integer (required) Example: 1

Unique identifier for an actuation result

Response  200
HideShow

Get actuation result details.

Body
{
  "data": {
    "parameters": [],
    "id": "e00667ce-78b5-4595-8288-3ff0e50ed147",
    "deviceTypes": [
      "devicetype1"
    ],
    "href": "https://localhost:3000/api/v1/actuation/requests/e00667ce-78b5-4595-8288-3ff0e50ed147",
    "finishedAt": "2017-01-10T08:50:21.846736",
    "function": "actuate_me",
    "devices": [],
    "results": [
      {
        "result": "failure",
        "address": "60866a"
      },
      {
        "result": "success",
        "address": "608477"
      }
    ]
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "type": "object",
        "properties": {
          "parameters": {
            "items": {
              "description": "List of parameters",
              "anyOf": [
                {
                  "type": [
                    "string",
                    "boolean",
                    "null",
                    "integer"
                  ]
                }
              ]
            },
            "type": "array"
          },
          "id": {
            "description": "Unique identifier for this device type",
            "type": "integer"
          },
          "deviceTypes": {
            "items": {
              "description": "List of device type descriptions",
              "type": "string"
            },
            "type": "array"
          },
          "href": {
            "description": "URI for this device type resource",
            "type": "string"
          },
          "finishedAt": {
            "description": "Time at which actuation finished",
            "type": "string"
          },
          "function": {
            "description": "Name of the function",
            "type": "string"
          },
          "devices": {
            "items": {
              "description": "List of device MAC addresses",
              "type": "string"
            },
            "type": "array"
          },
          "results": {
            "items": {
              "result": {
                "description": "Outcome of the attempted actuation, either success or failure",
                "type": "string"
              },
              "address": {
                "description": "MAC address for the device described in this result",
                "type": "string"
              }
            },
            "type": "array"
          },
          "createdAt": {
            "description": "Time at which actuation started",
            "type": "string"
          }
        }
      },
      "type": "array"
    }
  }
}
Response  404
HideShow

No such result.

Body
{
  "error": {
    "message": "Actuation result could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Administration

Backup

Backup database
GET/api/v1/backup

Create a backup of the current synapse-network-service database.

Example URI

GET /api/v1/backup
Response  200
HideShow

Successfully backed up database

Body
"Backup file: synapse-network-service.sqlite"
Response  400
HideShow

The database could not be backed up.

Body
{
  "error": {
    "message": "Unable to backup the database. Please check the server logs for more information."
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "message": {
        "type": "string"
      }
    }
  }
}

Configuration

Network

Handles requests for the /network resource path.

Get the current network settings
GET/api/v1/network

Example URI

GET /api/v1/network
Response  200
HideShow

Get current network settings details.

Body
{
  "data": {
    "actual_settings": {
      "rpcCrc": false,
      "encryptionKey": "YWFhYWJiYmJjY2NjZGRkZA==",
      "encryptionType": "AES-128",
      "packetCrc": true,
      "channel": 10,
      "networkId": "0x3ab3"
    },
    "configured_settings": {
      "rpcCrc": false,
      "encryptionKey": "YWFhYWJiYmJjY2NjZGRkZA==",
      "encryptionType": "AES-128",
      "packetCrc": true,
      "channel": 10,
      "networkId": "0x3ab3"
    },
    "bridge_addr": "012345"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "actual_settings": {
          "description": "Actual bridge node network settings",
          "type": "object",
          "properties": {
            "rpcCrc": {
              "description": "Indicates whether the RPC CRC packet integrity check is enabled",
              "type": "boolean"
            },
            "encryptionKey": {
              "description": "The Base64 encoded encryption key",
              "type": "string",
              "media": {
                "type": "octet-stream",
                "binaryEncoding": "base64"
              }
            },
            "encryptionType": {
              "description": "The type of encryption used to communicate",
              "enum": [
                "None",
                "AES-128",
                "Basic"
              ]
            },
            "packetCrc": {
              "description": "Indicates whether packet-level CRC validation is enabled",
              "type": "boolean"
            },
            "channel": {
              "description": "The RF channel",
              "type": "integer"
            },
            "networkId": {
              "description": "The network identifier (ex: '0x1c2c')",
              "type": "string"
            }
          }
        },
        "configured_settings": {
          "description": "Configured network settings",
          "type": "object",
          "properties": {
            "rpcCrc": {
              "description": "Indicates whether the RPC CRC packet integrity check should be enabled",
              "type": "boolean"
            },
            "encryptionKey": {
              "description": "The Base64 encoded encryption key",
              "type": "string",
              "media": {
                "type": "octet-stream",
                "binaryEncoding": "base64"
              }
            },
            "encryptionType": {
              "description": "The type of encryption used to communicate",
              "enum": [
                "None",
                "AES-128",
                "Basic"
              ]
            },
            "packetCrc": {
              "description": "Indicates whether packet-level CRC validation should be enabled",
              "type": "boolean"
            },
            "channel": {
              "description": "The RF channel",
              "type": "integer"
            },
            "networkId": {
              "description": "The network identifier (ex: '0x1c2c')",
              "type": "string"
            }
          }
        },
        "bridge_addr": {
          "description": "Device MAC address",
          "type": "string"
        }
      }
    }
  }
}
Response  400
HideShow

Could not get network settings.

Body
{
  "apiVersion": "v1",
  "error": {
    "code": 400,
    "message": "Could not get network settings"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "apiVersion": {
      "type": "string"
    },
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "description": "HTTP response status",
          "type": "integer"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Update the current network settings
PUT/api/v1/network

Example URI

PUT /api/v1/network
Request
HideShow
Body
{
  "rpcCrc": false,
  "encryptionKey": "YWFhYWJiYmJjY2NjZGRkZA==",
  "encryptionType": "AES-128",
  "packetCrc": true,
  "channel": 10,
  "networkId": "0x3ab3"
}
Schema
{
  "required": [
    "channel",
    "networkId",
    "rpcCrc",
    "packetCrc",
    "encryptionType",
    "encryptionKey"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "rpcCrc": {
      "description": "Indicates whether the RPC CRC packet integrity check should be enabled",
      "type": "boolean"
    },
    "encryptionKey": {
      "description": "The Base64 encoded encryption key",
      "type": "string",
      "media": {
        "type": "octet-stream",
        "binaryEncoding": "base64"
      }
    },
    "encryptionType": {
      "description": "The type of encryption used to communicate",
      "enum": [
        "None",
        "AES-128",
        "Basic"
      ]
    },
    "packetCrc": {
      "description": "Indicates whether packet-level CRC validation should be enabled",
      "type": "boolean"
    },
    "channel": {
      "description": "The RF channel",
      "type": "integer"
    },
    "networkId": {
      "description": "The network identifier (ex: '0x1c2c')",
      "type": "string"
    }
  },
  "description": "A group of network settings",
  "title": "Update network settings",
  "type": "object"
}
Response  200
HideShow

Successfully updated network settings.

Headers
Content-Type: application/json
Body
{
  "data": {
    "rpcCrc": false,
    "encryptionKey": "YWFhYWJiYmJjY2NjZGRkZA==",
    "encryptionType": "AES-128",
    "packetCrc": true,
    "channel": 10,
    "networkId": "0x3ab3"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "rpcCrc": {
          "description": "Indicates whether the RPC CRC packet integrity check is enabled",
          "type": "boolean"
        },
        "encryptionKey": {
          "description": "The Base64 encoded encryption key",
          "type": "string",
          "media": {
            "type": "octet-stream",
            "binaryEncoding": "base64"
          }
        },
        "encryptionType": {
          "description": "The type of encryption used to communicate",
          "enum": [
            "None",
            "AES-128",
            "Basic"
          ]
        },
        "packetCrc": {
          "description": "Indicates whether packet-level CRC validation is enabled",
          "type": "boolean"
        },
        "channel": {
          "description": "The RF channel",
          "type": "integer"
        },
        "networkId": {
          "description": "The network identifier (ex: '0x1c2c')",
          "type": "string"
        }
      }
    }
  }
}
Response  400
HideShow

Could not update network settings.

Body
{
  "apiVersion": "v1",
  "error": {
    "code": 400,
    "message": "Could not update network settings"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "apiVersion": {
      "type": "string"
    },
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "description": "HTTP response status",
          "type": "integer"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Data Collector

Data Collector Collection

Get the list of data collectors
GET/api/v1/dc

Example URI

GET /api/v1/dc
Response  200
HideShow

List all data collectors.

Headers
Content-Type: application/json
Body
{
  "data": [
    {
      "data_collector_type": "asynchronous",
      "id": 1,
      "deviceTypes": [
        "sensors"
      ],
      "initRpcName": "setReceiverAddress",
      "name": "dc1",
      "href": "https://localhost:3000/api/v1/dc/dc1",
      "dataRpcName": "acceptData"
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "description": "Unique identifier for this data collector",
            "type": "integer"
          },
          "deviceTypes": {
            "items": {
              "description": "Description of device type",
              "type": "string"
            },
            "type": "array"
          },
          "initRpcName": {
            "description": "Name of function implemented by SNAPpy script (async only)",
            "type": "string"
          },
          "name": {
            "description": "Name of data collector",
            "type": "string"
          },
          "dataCollectorType": {
            "description": "Data collector type, one of 'synchronous' or 'asynchronous'",
            "type": "string"
          },
          "href": {
            "description": "URI for this data collector resource",
            "type": "string"
          },
          "queryFunction": {
            "description": "Name of query function (sync only)",
            "type": "string"
          },
          "dataRpcName": {
            "description": "Name of the RPC that the receiver will listen on for new data (async only)",
            "type": "string"
          },
          "pollInterval": {
            "description": "Number of seconds between polls (sync only)",
            "type": "integer"
          }
        }
      },
      "type": "array"
    }
  }
}

Create a data collector
POST/api/v1/dc

Example URI

POST /api/v1/dc
Request
HideShow
Body
{
  "dataCollectorType": "synchronous",
  "deviceTypes": [
    "sensors"
  ],
  "queryFunction": "data",
  "name": "dc1",
  "pollInterval": 60
}
Schema
{
  "required": [
    "name",
    "deviceTypes"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "deviceTypes": {
      "items": {
        "description": "Description of device type",
        "type": "string"
      },
      "type": "array"
    },
    "initRpcName": {
      "anyOf": [
        {
          "description": "Name of function implemented by SNAPpy script (required for async only)",
          "type": "string",
          "pattern": "^[a-zA-Z]\\w*$",
          "pattern_description": "Init functions must be valid public SNAPpy functions. (ex: 'data', 'query_2B')"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "description": "Name of data collector",
      "type": "string",
      "pattern": "^[A-z0-9_.-]+$",
      "pattern_description": "Data collector names must be letters, numbers, underscores, periods, and dashes. (ex: 'dc1', 'Data_Collector.1-b')"
    },
    "dataCollectorType": {
      "description": "Data collector type, one of 'synchronous' or 'asynchronous'",
      "type": "string"
    },
    "queryFunction": {
      "description": "Name of query function (required for sync only)",
      "type": "string",
      "pattern": "^[a-zA-Z]\\w*$",
      "pattern_description": "Query functions must be valid public SNAPpy functions. (ex: 'data', 'query_2B')"
    },
    "dataRpcName": {
      "description": "Name of the RPC that the receiver will listen on for new data (required for async only)",
      "type": "string",
      "pattern": "^[a-zA-Z]\\w*$",
      "pattern_description": "Data functions must be valid public SNAPpy functions. (ex: 'data', 'query_2B')"
    },
    "pollInterval": {
      "description": "Number of seconds between polls (required for sync only)",
      "minimum": 5,
      "type": "integer",
      "maximum": 86400
    }
  },
  "description": "A data collector",
  "title": "Add data collector",
  "type": "object"
}
Response  201
HideShow

Successfully created data collector.

Body
{
  "data": {
    "id": 1,
    "deviceTypes": [
      "sensors"
    ],
    "initRpcName": "setReceiverAddress",
    "name": "dc1",
    "dataCollectorType": "asynchronous",
    "href": "https://localhost:3000/api/v1/dc/dc1",
    "dataRpcName": "acceptData"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "description": "Unique identifier for this data collector",
          "type": "integer"
        },
        "deviceTypes": {
          "items": {
            "description": "Description of device type",
            "type": "string"
          },
          "type": "array"
        },
        "initRpcName": {
          "description": "Name of function implemented by SNAPpy script (async only)",
          "type": "string"
        },
        "name": {
          "description": "Name of data collector",
          "type": "string"
        },
        "dataCollectorType": {
          "description": "Data collector type, one of 'synchronous' or 'asynchronous'",
          "type": "string"
        },
        "href": {
          "description": "URI for this data collector resource",
          "type": "string"
        },
        "queryFunction": {
          "description": "Name of query function (sync only)",
          "type": "string"
        },
        "dataRpcName": {
          "description": "Name of the RPC that the receiver will listen on for new data (async only)",
          "type": "string"
        },
        "pollInterval": {
          "description": "Number of seconds between polls (sync only)",
          "type": "integer"
        }
      }
    }
  }
}
Response  409
HideShow

A data collector with this name already exists.

Body
{
  "error": {
    "message": "A data collector with this name already exists"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  400
HideShow

A data collector could not be added with these attributes.

Body
{
  "error": {
    "message": "A data collector could not be added with these attributes"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Data Collector

Delete a data collector
DELETE/api/v1/dc/{name}

Example URI

DELETE /api/v1/dc/dc1
URI Parameters
HideShow
name
string (required) Example: dc1

Name of a data collector.

Response  204
HideShow

Successfully deleted data collector.

Response  404
HideShow

No data collector found for this identifier.

Body
{
  "error": {
    "message": "Data collector could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Data Collector Configuration

Get a single data collector's configuration
GET/api/v1/dc/{name}/config

Example URI

GET /api/v1/dc/dc1/config
URI Parameters
HideShow
name
string (required) Example: dc1

Name of a data collector.

Response  200
HideShow

Get data collector details.

Headers
Content-Type: application/json
Body
{
  "data": {
    "id": 1,
    "deviceTypes": [
      "sensors"
    ],
    "href": "https://localhost:3000/api/v1/dc/dc1",
    "name": "dc1",
    "dataCollectorType": "synchronous",
    "queryFunction": "data",
    "pollInterval": 60
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "description": "Unique identifier for this data collector",
          "type": "integer"
        },
        "deviceTypes": {
          "items": {
            "description": "Description of device type",
            "type": "string"
          },
          "type": "array"
        },
        "initRpcName": {
          "description": "Name of function implemented by SNAPpy script (async only)",
          "type": "string"
        },
        "name": {
          "description": "Name of data collector",
          "type": "string"
        },
        "dataCollectorType": {
          "description": "Data collector type, one of 'synchronous' or 'asynchronous'",
          "type": "string"
        },
        "href": {
          "description": "URI for this data collector resource",
          "type": "string"
        },
        "queryFunction": {
          "description": "Name of query function (sync only)",
          "type": "string"
        },
        "dataRpcName": {
          "description": "Name of the RPC that the receiver will listen on for new data (async only)",
          "type": "string"
        },
        "pollInterval": {
          "description": "Number of seconds between polls (sync only)",
          "type": "integer"
        }
      }
    }
  }
}

Update a single data collector
PUT/api/v1/dc/{name}/config

Example URI

PUT /api/v1/dc/dc1/config
URI Parameters
HideShow
name
string (required) Example: dc1

Name of a data collector.

Request
HideShow
Body
{
  "dataCollectorType": "asynchronous",
  "deviceTypes": [
    "sensors"
  ],
  "initRpcName": "setReceiverAddress",
  "name": "dc1",
  "dataRpcName": "acceptData"
}
Schema
{
  "description": "A data collector",
  "type": "object",
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Update a data collector",
  "properties": {
    "deviceTypes": {
      "items": {
        "description": "Description of device type",
        "type": "string"
      },
      "type": "array"
    },
    "initRpcName": {
      "anyOf": [
        {
          "description": "Name of function implemented by SNAPpy script (required for async only)",
          "type": "string",
          "pattern": "^[a-zA-Z]\\w*$",
          "pattern_description": "Init functions must be valid public SNAPpy functions. (ex: 'data', 'query_2B')"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "description": "Name of data collector",
      "type": "string",
      "pattern": "^[A-z0-9_.-]+$",
      "pattern_description": "Data collector names must be letters, numbers, underscores, periods, and dashes. (ex: 'dc1', 'Data_Collector.1-b')"
    },
    "dataCollectorType": {
      "description": "Data collector type, one of 'synchronous' or 'asynchronous'",
      "type": "string"
    },
    "queryFunction": {
      "description": "Name of query function (required for sync only)",
      "type": "string",
      "pattern": "^[a-zA-Z]\\w*$",
      "pattern_description": "Query functions must be valid public SNAPpy functions. (ex: 'data', 'query_2B')"
    },
    "dataRpcName": {
      "description": "Name of the RPC that the receiver will listen on for new data (required for async only)",
      "type": "string",
      "pattern": "^[a-zA-Z]\\w*$",
      "pattern_description": "Data functions must be valid public SNAPpy functions. (ex: 'data', 'query_2B')"
    },
    "pollInterval": {
      "description": "Number of seconds between polls (required for sync only)",
      "minimum": 5,
      "type": "integer",
      "maximum": 86400
    }
  }
}
Response  200
HideShow

Successfully updated data collector.

Body
{
  "data": {
    "id": 1,
    "deviceTypes": [
      "sensors"
    ],
    "initRpcName": "setReceiverAddress",
    "name": "dc1",
    "dataCollectorType": "asynchronous",
    "href": "https://localhost:3000/api/v1/dc/dc1",
    "dataRpcName": "acceptData"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "description": "Unique identifier for this data collector",
          "type": "integer"
        },
        "deviceTypes": {
          "items": {
            "description": "Description of device type",
            "type": "string"
          },
          "type": "array"
        },
        "initRpcName": {
          "description": "Name of function implemented by SNAPpy script (async only)",
          "type": "string"
        },
        "name": {
          "description": "Description of data collector type",
          "type": "string"
        },
        "dataCollectorType": {
          "description": "Data collector type, one of 'synchronous' or 'asynchronous'",
          "type": "string"
        },
        "href": {
          "description": "URI for this data collector resource",
          "type": "string"
        },
        "queryFunction": {
          "description": "Name of query function (sync only)",
          "type": "string"
        },
        "dataRpcName": {
          "description": "Name of the RPC that the receiver will listen on for new data (async only)",
          "type": "string"
        },
        "pollInterval": {
          "description": "Number of seconds between polls (sync only)",
          "type": "integer"
        }
      }
    }
  }
}

Devices

Device Collection

Get list of devices
GET/api/v1/devices{?type}{&expand}

Example URI

GET /api/v1/devices?type=Sensor&expand=firmware,image
URI Parameters
HideShow
type
string (optional) Example: Sensor

Limit result to devices with this device type.

expand
string (optional) Example: firmware,image

Expand HREF properties to full objects (e.g. ?expand=firmware,image).

Response  200
HideShow

List all devices.

Body
{
  "data": [
    {
      "upgrading": false,
      "id": 2,
      "href": "https://localhost:3000/api/v1/devices/2",
      "image": {
        "href": "https://localhost:3000/api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d"
      },
      "description": "test",
      "addr": "aabbcc",
      "platform": "RF200",
      "deviceType": "Deck1",
      "firmware": {
        "href": "https://localhost:3000/api/v1/firmware/2.7.1"
      }
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "type": "object",
        "properties": {
          "upgrading": {
            "description": "Indicates whether device is upgrading",
            "type": "boolean"
          },
          "id": {
            "description": "Unique identifier for this device",
            "type": "integer"
          },
          "href": {
            "description": "URI for this device resource",
            "type": "string"
          },
          "image": {
            "description": "Software on device",
            "type": "object",
            "properties": {
              "href": {
                "description": "URI for this image resource",
                "type": "string"
              }
            }
          },
          "description": {
            "description": "User defined name for the device",
            "type": "string"
          },
          "addr": {
            "description": "Device MAC address",
            "type": "string",
            "pattern": "^(00[.:]?1[cC][.:]?2[cC][.:]?[0-9a-fA-F]{2}[.:]?[0-9a-fA-F]{2}[.:]?)?([0-9a-fA-F][.:]?){5}[0-9a-fA-F]$",
            "pattern_description": "A valid SNAP address must be a hex value of at least 6 digits with optional period or colon delimiters (ex: a18ca9, 04:3E:82)."
          },
          "platform": {
            "description": "Hardware platform",
            "type": "string"
          },
          "deviceType": {
            "description": "Device type",
            "type": "string"
          },
          "firmware": {
            "description": "Firmware on device",
            "type": "object",
            "properties": {
              "href": {
                "description": "URI for this firmware resource",
                "type": "string"
              }
            }
          }
        }
      },
      "type": "array"
    }
  }
}

Create a device
POST/api/v1/devices

Clients should use this endpoint to create a single new Device resource. If you need to create a lot of new devices in a bulk operation, please refer to the Device Batches <device_batches.html>_ section.

Example URI

POST /api/v1/devices
Request
HideShow
Body
{
  "description": "Device1",
  "addr": "ccddee",
  "deviceType": "Deck1",
  "platform": "RF200"
}
Schema
{
  "required": [
    "addr",
    "description",
    "platform",
    "deviceType"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "description": {
      "description": "Description of the device",
      "type": "string"
    },
    "addr": {
      "description": "SNAP MAC address",
      "type": "string",
      "pattern": "^(00[.:]?1[cC][.:]?2[cC][.:]?[0-9a-fA-F]{2}[.:]?[0-9a-fA-F]{2}[.:]?)?([0-9a-fA-F][.:]?){5}[0-9a-fA-F]$",
      "pattern_description": "A valid SNAP Address must be a hex value of at least 6 digits with optional period or colon delimiters (ex:\"a18ca9\", \"04:3E:82\")."
    },
    "deviceType": {
      "description": "The type of device. This must exist in the database already.",
      "type": "string"
    },
    "platform": {
      "description": "The device platform (ex: RF200)",
      "type": "string"
    }
  },
  "description": "A device",
  "title": "Add device",
  "type": "object"
}
Response  201
HideShow

Successfully created device.

Headers
Location: https://localhost:3000/api/v1/devices/6
Content-Type: application/json
Body
{
  "data": {
    "upgrading": false,
    "id": 6,
    "href": "https://localhost:3000/api/v1/devices/6",
    "image": {
      "href": "Unknown"
    },
    "description": "Device1",
    "addr": "ccddee",
    "platform": "RF200",
    "deviceType": "Deck1",
    "firmware": {
      "href": "Unknown"
    }
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "upgrading": {
          "description": "Indicates whether device is upgrading",
          "type": "boolean"
        },
        "id": {
          "description": "Unique identifier for device",
          "type": "integer"
        },
        "href": {
          "description": "URI for this device resource",
          "type": "string"
        },
        "description": {
          "description": "Description of device",
          "type": "string"
        },
        "addr": {
          "description": "Address of device",
          "type": "string"
        },
        "platform": {
          "description": "Type of platform",
          "type": "string"
        },
        "deviceType": {
          "description": "Type of device",
          "type": "string"
        }
      }
    }
  }
}
Response  400
HideShow

Can’t create this device because required device properties are missing.

Body
{
  "error": {
    "message": "The following properties are required: addr, description, platform, deviceType"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  404
HideShow

Couldn’t find a device type with the specified deviceType description.

Body
{
  "error": {
    "message": "Device type could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  409
HideShow

Some other device with this MAC address already exists.

Body
{
  "error": {
    "message": "A device with this address already exists"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Device

Get a single device
GET/api/v1/devices/{deviceId}

Example URI

GET /api/v1/devices/2
URI Parameters
HideShow
deviceId
integer (required) Example: 2

Unique identifier for a device.

Response  200
HideShow

Get device details.

Body
{
  "data": {
    "upgrading": false,
    "id": 2,
    "href": "https://localhost:3000/api/v1/devices/2",
    "image": {
      "href": "https://localhost:3000/api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d"
    },
    "description": "test",
    "addr": "aabbcc",
    "platform": "RF200",
    "deviceType": "Deck1",
    "firmware": {
      "href": "https://localhost:3000/api/v1/firmware/2.7.1"
    }
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "upgrading": {
          "description": "Indicates whether device is upgrading",
          "type": "boolean"
        },
        "id": {
          "description": "Unique identifier for this device",
          "type": "integer"
        },
        "href": {
          "description": "URI for this device resource",
          "type": "string"
        },
        "image": {
          "description": "Software on device",
          "type": "object",
          "properties": {
            "href": {
              "description": "URI for this image resource",
              "type": "string"
            }
          }
        },
        "description": {
          "description": "User defined name for the device",
          "type": "string"
        },
        "addr": {
          "description": "Device MAC address",
          "type": "string",
          "pattern": "^(00[.:]?1[cC][.:]?2[cC][.:]?[0-9a-fA-F]{2}[.:]?[0-9a-fA-F]{2}[.:]?)?([0-9a-fA-F][.:]?){5}[0-9a-fA-F]$",
          "pattern_description": "A valid SNAP address must be a hex value of at least 6 digits with optional period or colon delimiters (ex: a18ca9, 04:3E:82)."
        },
        "platform": {
          "description": "Hardware platform",
          "type": "string"
        },
        "deviceType": {
          "description": "Device type",
          "type": "string"
        },
        "firmware": {
          "description": "Firmware on device",
          "type": "object",
          "properties": {
            "href": {
              "description": "URI for this firmware resource",
              "type": "string"
            }
          }
        }
      }
    }
  }
}
Response  404
HideShow

No device found for this identifier.

Body
{
  "error": {
    "message": "Device could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Update Device
PUT/api/v1/devices/{deviceId}

Example URI

PUT /api/v1/devices/2
URI Parameters
HideShow
deviceId
integer (required) Example: 2

Unique identifier for a device.

Request
HideShow
Body
{
  "description": "Device1",
  "addr": "ccddee",
  "deviceType": "Deck1",
  "platform": "RF200"
}
Schema
{
  "description": "A device",
  "type": "object",
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "description": {
      "description": "Description of the device",
      "type": "string"
    },
    "addr": {
      "description": "SNAP MAC address",
      "type": "string",
      "pattern": "^(00[.:]?1[cC][.:]?2[cC][.:]?[0-9a-fA-F]{2}[.:]?[0-9a-fA-F]{2}[.:]?)?([0-9a-fA-F][.:]?){5}[0-9a-fA-F]$",
      "pattern_description": "A valid SNAP Address must be a hex value of at least 6 digits with optional period or colon delimiters (ex:\"a18ca9\", \"04:3E:82\")."
    },
    "deviceType": {
      "description": "The type of device. This must exist in the database already.",
      "type": "string"
    },
    "platform": {
      "description": "The device platform (ex: RF200)",
      "type": "string"
    }
  },
  "title": "Update device"
}
Response  200
HideShow

Successfully updated device.

Headers
Content-Type: application/json
Body
{
  "data": {
    "upgrading": false,
    "id": 6,
    "href": "https://localhost:3000/api/v1/devices/6",
    "image": {
      "href": "Unknown"
    },
    "description": "Device1",
    "addr": "ccddee",
    "platform": "RF200",
    "deviceType": "Deck1",
    "firmware": {
      "href": "Unknown"
    }
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "upgrading": {
          "description": "Indicates whether device is upgrading",
          "type": "boolean"
        },
        "id": {
          "description": "Unique identifier for device",
          "type": "integer"
        },
        "href": {
          "description": "URI for this device resource",
          "type": "string"
        },
        "image": {
          "description": "Image of device",
          "type": "object",
          "properties": {
            "href": {
              "description": "URI for this image resource",
              "type": "string"
            }
          }
        },
        "description": {
          "description": "Description of device",
          "type": "string"
        },
        "addr": {
          "description": "Address of device",
          "type": "string"
        },
        "platform": {
          "description": "Type of platform",
          "type": "string"
        },
        "deviceType": {
          "description": "Type of device",
          "type": "string"
        },
        "firmware": {
          "description": "Firmware of device",
          "type": "object",
          "properties": {
            "href": {
              "description": "URI for this firmware resource",
              "type": "string"
            }
          }
        }
      }
    }
  }
}
Response  400
HideShow

Can’t update this device because required device properties are missing.

Body
{
  "error": {
    "message": "The following properties are required: addr, description, platform, deviceType"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  404
HideShow

No device found for this identifier, or couldn’t find a device type with the specified deviceType description.

Body
{
  "error": {
    "message": "Device could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  409
HideShow

Can’t update this device’s address to the specified address, because that address is assigned to some other device in the system.

Body
{
  "error": {
    "message": "A device with this address already exists"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Delete Device
DELETE/api/v1/devices/{deviceId}

Example URI

DELETE /api/v1/devices/2
URI Parameters
HideShow
deviceId
integer (required) Example: 2

Unique identifier for a device.

Response  204
HideShow

Successfully deleted device.

Response  404
HideShow

No device found for this identifier.

Body
{
  "error": {
    "message": "Device could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Device Batches

Batch Device Operations

Create a Batch of Devices
POST/api/v1/devices/batches

Use this endpoint to efficiently create a large number of Device resources.

Example URI

POST /api/v1/devices/batches
Request
HideShow
Body
{
  "devices": [
    {
      "description": "Device1",
      "addr": "60866a",
      "deviceType": "Deck1",
      "platform": "RF200"
    },
    {
      "description": "Device2",
      "addr": "608477",
      "deviceType": "Deck1",
      "platform": "RF200"
    }
  ]
}
Schema
{
  "required": [
    "devices"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "devices": {
      "items": {
        "required": [
          "addr",
          "description",
          "platform",
          "deviceType"
        ],
        "type": "object",
        "properties": {
          "description": {
            "description": "Description of the device",
            "type": "string",
            "minLength": 1
          },
          "addr": {
            "description": "SNAP MAC address",
            "type": "string",
            "pattern": "^(00[.:]?1[cC][.:]?2[cC][.:]?[0-9a-fA-F]{2}[.:]?[0-9a-fA-F]{2}[.:]?)?([0-9a-fA-F][.:]?){5}[0-9a-fA-F]$",
            "pattern_description": "A valid SNAP Address must be a hex value of at least 6 digits with optional period or colon delimiters (ex:\"a18ca9\", \"04:3E:82\")."
          },
          "deviceType": {
            "description": "The type of device. This must exist in the database already.",
            "type": "string",
            "minLength": 1
          },
          "platform": {
            "description": "The device platform (ex: RF200)",
            "type": "string",
            "minLength": 1
          }
        }
      },
      "type": "array"
    }
  },
  "description": "Batch of devices",
  "title": "Add batch of devices",
  "type": "object"
}
Response  201
HideShow

Successfully created devices.

Headers
Location: https://localhost:3000/api/v1/devices/batches/b38baa5f-ce28-41a3-9bdd-4a14934e826c
Content-Type: application/json
Body
{
  "data": {
    "href": "https://localhost:3000/api/v1/devices/batches/b38baa5f-ce28-41a3-9bdd-4a14934e826c",
    "devices": [
      {
        "upgrading": false,
        "id": 6,
        "href": "https://localhost:3000/api/v1/devices/6",
        "image": {
          "href": "Unknown"
        },
        "description": "Device1",
        "addr": "60866a",
        "platform": "RF200",
        "deviceType": "Deck1",
        "firmware": {
          "href": "Unknown"
        }
      },
      {
        "upgrading": false,
        "id": 7,
        "href": "https://localhost:3000/api/v1/devices/7",
        "image": {
          "href": "Unknown"
        },
        "description": "Device2",
        "addr": "608477",
        "platform": "RF200",
        "deviceType": "Deck1",
        "firmware": {
          "href": "Unknown"
        }
      }
    ]
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "href": {
          "description": "URI for this batch of devices",
          "type": "string"
        },
        "devices": {
          "items": {
            "type": "object",
            "properties": {
              "upgrading": {
                "description": "Indicates whether device is upgrading",
                "type": "boolean"
              },
              "id": {
                "description": "Unique identifier for device",
                "type": "integer"
              },
              "href": {
                "description": "URI for this device resource",
                "type": "string"
              },
              "image": {
                "type": "object",
                "properties": {
                  "href": {
                    "description": "URI for this image resource",
                    "type": "string"
                  }
                }
              },
              "description": {
                "description": "Description of device",
                "type": "string"
              },
              "addr": {
                "description": "Address of device",
                "type": "string"
              },
              "platform": {
                "description": "Type of platform",
                "type": "string"
              },
              "deviceType": {
                "description": "Type of device",
                "type": "string"
              },
              "firmware": {
                "type": "object",
                "properties": {
                  "href": {
                    "description": "URI for this firmware resource",
                    "type": "string"
                  }
                }
              }
            }
          },
          "type": "array"
        }
      }
    }
  }
}
Response  400
HideShow

Can’t create one or more devices because required device properties are missing.

Body
{
  "error": {
    "message": "The following properties are required: addr, description, platform, deviceType"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  404
HideShow

Couldn’t find a device type with the specified deviceType description.

Body
{
  "error": {
    "message": "Device type could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  409
HideShow

Some other device with this MAC address already exists.

Body
{
  "error": {
    "message": "A device with this address already exists"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Device Types

Device Types Collection

Get list of device types
GET/api/v1/deviceTypes

Example URI

GET /api/v1/deviceTypes
Response  200
HideShow

List all device types.

Headers
Content-Type: application/json
Body
{
  "data": [
    {
      "description": "Some Device Type",
      "id": 1,
      "href": "https://localhost:3000/api/v1/deviceTypes/"
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "type": "object",
        "properties": {
          "description": {
            "description": "Name of device type",
            "type": "string"
          },
          "id": {
            "description": "Unique identifier for this device type",
            "type": "integer"
          },
          "href": {
            "description": "URI for this device type resource",
            "type": "string"
          }
        }
      },
      "type": "array"
    }
  }
}

Create device type
POST/api/v1/deviceTypes

Example URI

POST /api/v1/deviceTypes
Request
HideShow
Body
{
  "description": "Some Device Type"
}
Schema
{
  "required": [
    "description"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "description": {
      "description": "A unique device type",
      "type": "string",
      "minLength": 1
    }
  },
  "description": "A device type",
  "title": "Add device type",
  "type": "object"
}
Response  201
HideShow

Successfully created device type.

Headers
Location: https://localhost:3000/api/v1/deviceTypes/1
Content-Type: application/json
Body
{
  "data": {
    "description": "Some Device Type",
    "id": 1,
    "href": "https://localhost:3000/api/v1/deviceTypes/1"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "description": {
          "description": "Name of device type",
          "type": "string"
        },
        "id": {
          "description": "Unique identifier for this device type",
          "type": "integer"
        },
        "href": {
          "description": "URI for this device type resource",
          "type": "string"
        }
      }
    }
  }
}
Response  409
HideShow

A device type with this description already exists.

Body
{
  "error": {
    "message": "A device type with this description already exists"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Device Type

Get a single device type
GET/api/v1/deviceTypes/{deviceTypeId}

Example URI

GET /api/v1/deviceTypes/1
URI Parameters
HideShow
deviceTypeId
integer (required) Example: 1

Unique identifier for a device type.

Response  200
HideShow

Get device type details.

Body
{
  "data": [
    {
      "description": "Some Device Type",
      "id": 1,
      "href": "https://localhost:3000/api/v1/deviceTypes/1"
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "type": "object",
        "properties": {
          "description": {
            "description": "Name of device type",
            "type": "string"
          },
          "id": {
            "description": "Unique identifier for this device type",
            "type": "integer"
          },
          "href": {
            "description": "URI for this device type resource",
            "type": "string"
          }
        }
      },
      "type": "array"
    }
  }
}

Update device type
PUT/api/v1/deviceTypes/{deviceTypeId}

Example URI

PUT /api/v1/deviceTypes/1
URI Parameters
HideShow
deviceTypeId
integer (required) Example: 1

Unique identifier for a device type.

Request
HideShow
Body
{
  "description": "Some Device Type"
}
Schema
{
  "required": [
    "description"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "description": {
      "description": "Type of device",
      "type": "string",
      "minLength": 1
    }
  },
  "description": "A device type",
  "title": "Update device type",
  "type": "object"
}
Response  200
HideShow

Successfully updated device type.

Headers
Content-Type: application/json
Body
{
  "data": {
    "description": "Some Device Type",
    "id": 1,
    "href": "https://localhost:3000/api/v1/deviceTypes/1"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "description": {
          "description": "Name of device type",
          "type": "string"
        },
        "id": {
          "description": "Unique identifier for this device type",
          "type": "integer"
        },
        "href": {
          "description": "URI for this device type resource",
          "type": "string"
        }
      }
    }
  }
}
Response  404
HideShow

No device type found for this identifier.

Body
{
  "error": {
    "message": "Device type could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  409
HideShow

Some other device type with this description already exists.

Body
{
  "error": {
    "message": "A device type with this description already exists"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Delete device type
DELETE/api/v1/deviceTypes/{deviceTypeId}

Example URI

DELETE /api/v1/deviceTypes/1
URI Parameters
HideShow
deviceTypeId
integer (required) Example: 1

Unique identifier for a device type.

Response  204
HideShow

Successfully deleted device type.

Response  404
HideShow

No device type found for this identifier.

Body
{
  "error": {
    "message": "Device type could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Firmware

Firmware Collection

The list of available firmware is determined by inspecting the SNAP firmware packages installed on your gateway; it does not necessarily correspond to all of the firmware currently available from Synapse Wireless.

Retrieve list of available firmware
GET/api/v1/firmware

Example URI

GET /api/v1/firmware
Response  200
HideShow

List all firmware resources.Note that if no SNAP firmware is available, this will return an empty array.

Headers
Content-Type: application/json
Body
{
  "data": [
    {
      "version": "2.6.9",
      "href": "https://localhost:3000/api/v1/firmware/2.6.9"
    },
    {
      "version": "2.7.1",
      "href": "https://localhost:3000/api/v1/firmware/2.7.1"
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "description": "A SNAP firmware release",
        "type": "object",
        "properties": {
          "version": {
            "description": "Firmware version number",
            "type": "string"
          },
          "href": {
            "description": "URI for this firmware resource",
            "type": "string"
          }
        }
      },
      "type": "array"
    }
  }
}

Firmware

Retrieve specific firmware resource
GET/api/v1/firmware/{firmwareVersion}

Example URI

GET /api/v1/firmware/2.7.1
URI Parameters
HideShow
firmwareVersion
string (required) Example: 2.7.1

Unique identifier for a firmware version.

Response  200
HideShow

Get firmware resource details.

Body
{
  "data": {
    "version": "2.7.1",
    "href": "https://localhost:3000/api/v1/firmware/2.7.1"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "description": "A SNAP firmware release",
      "type": "object",
      "properties": {
        "version": {
          "description": "Firmware version number",
          "type": "string"
        },
        "href": {
          "description": "URI for this firmware resource",
          "type": "string"
        }
      }
    }
  }
}
Response  404
HideShow

There is no available firmware corresponding to this firmware version number.

Body
{
  "error": {
    "message": "Firmware could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

License

License

Apply a License
PUT/api/v1/license

The license needs to be Base64-encoded before it can be uploaded to SNAP Thing Services.

Please contact Synapse Customer Service to receive a license. A license gives you access to bulk upgrades, data collection with no node limit, and topology generation with no node limit.

Example URI

PUT /api/v1/license
Response  200
HideShow

Successfully applied SNAP Thing Services License

Delete the license
DELETE/api/v1/license

Example URI

DELETE /api/v1/license
Response  204
HideShow

The license was successfully deleted.

License Capabilities

Get license capabilities
GET/api/v1/licenseCapabilities

Example URI

GET /api/v1/licenseCapabilities
Response  200
HideShow

Get current license details.

Headers
Content-Type: application/json
Body
{
  "data": {
    "types": [
      "manage",
      "deploy"
    ],
    "dataCollector": true,
    "actuation": true,
    "siteDoctor": true,
    "expiration": "2020-02-05",
    "siteDirector": true,
    "customer": "John Smith"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "types": {
          "items": {
            "description": "License types",
            "type": "string"
          },
          "type": "array"
        },
        "dataCollector": {
          "description": "True if the Data Collector is licensed",
          "type": "boolean"
        },
        "actuation": {
          "description": "True if Actuation is licensed",
          "type": "boolean"
        },
        "siteDoctor": {
          "description": "True if the Site Doctor is licensed",
          "type": "boolean"
        },
        "expiration": {
          "description": "The date the license expires",
          "type": "string"
        },
        "siteDirector": {
          "description": "True if the Site Director is licensed",
          "type": "boolean"
        },
        "customer": {
          "description": "The licensed customer",
          "type": "string"
        }
      }
    }
  }
}

Site Configuration

Import Site Configuration

Get site configuration
GET/api/v1/siteConfig

Example URI

GET /api/v1/siteConfig
Response  200
HideShow

Returns an exported site configuration.

Body
{
  "data": {
    "deviceTypes": [
      {
        "description": "a device type description"
      },
      {
        "description": "another device type description"
      }
    ],
    "dataCollectors": [
      {
        "dataCollectorType": "asynchronous",
        "deviceTypes": [
          "sensors"
        ],
        "initRpcName": "setReceiverAddress",
        "name": "dc1",
        "dataRpcName": "acceptData"
      },
      {
        "dataCollectorType": "synchronous",
        "deviceTypes": [
          "lights"
        ],
        "queryFunction": "data",
        "name": "dc2",
        "pollInterval": 60
      }
    ],
    "images": [
      {
        "crc": "0xda95",
        "size": 3489,
        "id": "46fed882-98da-497f-8400-9c92f4c66bb0",
        "file": "/d9CprNlBqsxQ8oJ+23SCfkIrXOaoUIaxHNoVK5xo3FLuS9uDXBRO1ommFU6wmMvssqK13qPGMFBe7gc/IaZY8c6fK0KnAgY/WPZWAsQGi1xDP+L7hoi8J0lts3BCJ1czjzCE9y4H176wcKqyezON3FW/0HvYJG9WpgR18eKFe6mW3ylE5QAltxIQG8jQBlXsOU82J7G8mdsds9prCbC8A2Vqiekmgza4Q7l6MnStBilePZxqhYipsWnifMiq4UsHatKcnfZd7ohnf49wQLMS8h1t3R/WYcYfJy7VSso8g6wJ8K5LRv1l3AH1qE9ohJERfc7C1aWAq/ApYIVTBxcFt6yuytjskB1QWoXoQ6l+9qmR//H8KiQbWcw6D/j5FBW61Py1ZHU45r66FSP1FeqjCv9dwGx5qkF9OSM0g9bsObdahldQ1nS1xdV+Zg/RkVSAeeMmrFqg3tTPLslRbckDW6kj/F/KZaiqrAjjK25REMjcEv9aRg8lBiwqvxLcAev6Kd3KKH27rlqH3WhbrYBe4AUFw7kNgjPQ3gIX8jf0HJOl3PZO32FuJksQfjvO7xW94sXC0BUbXrszZ+WDKMY4rmN2YGHflE9L+yChq/DpKSuG2eahqLb915osWahSDd2RQ27aQ3SDXwd8jKwAjpxKR0FWxp8yLDgoIUFJwWJBjyun+4f+qXLE5Zvz1B1z6f06I+VMwQWjNMPo9JeA5iuyL5O+wVYDlpBsoUnY38Vsw6vLYmQNb8nnGfo1Sonu5W9O3gUTVNKVDB6F4qJLDLCgVVWXdmJGvC8qVg3n+ggbT/5yiMh6nmaLeqLMPZZViMn52jAVbIJQvcWTvttUwdH9Qpf3m7aJdpP834XPcvnrWSBg4TyOdG/M5SyJFFXDIgFQNsj6UoGEqADDi9pB1eAO/iwGGB7tciD4x/yrkHgqMd0XJPDOVZzr1h2v7IHhOtbh3szXcaGJNTwMqiwC6ihtgips1MJahpaky73VUDMWcnggoaTSOOJvEPZ8SNhgyec0wj6UhpDp9uJYbdxWFcf8ad97l9EesoyfOzIbyoS7SqpFDS/+JZFvb7MaZV8v3AQkJkr/SWs74vz3Nng6rbF8IANK7yDuoEf8LmwwZJtbXoCaZmsERt73ZprdRWztDX4n7PdF/7mJ37yVg/W4+2vPm8FqQ5BE1BwcgwTNd7/QJyhNTcNvm/BDIgZ4o/78KhQUxRsiBP85ck2WcvDf9hKlS+xixom7qY4PazAVWMRhvefg99ANuj1r3o38sTMlYOf",
        "name": "MCastCounter"
      },
      {
        "crc": "0xda95",
        "size": 2785,
        "id": "12abc882-98da-497f-8400-9c92f4c66bb0",
        "file": "/d9CprNlBqsxQ8oJ+23SCfkIrXOaoUIaxHNoVK5xo3FLuS9uDXBRO1ommFU6wmMvssqK13qPGMFBe7gc/IaZY8c6fK0KnAgY/WPZWAsQGi1xDP+L7hoi8J0lts3BCJ1czjzCE9y4H176wcKqyezON3FW/0HvYJG9WpgR18eKFe6mW3ylE5QAltxIQG8jQBlXsOU82J7G8mdsds9prCbC8A2Vqiekmgza4Q7l6MnStBilePZxqhYipsWnifMiq4UsHatKcnfZd7ohnf49wQLMS8h1t3R/WYcYfJy7VSso8g6wJ8K5LRv1l3AH1qE9ohJERfc7C1aWAq/ApYIVTBxcFt6yuytjskB1QWoXoQ6l+9qmR//H8KiQbWcw6D/j5FBW61Py1ZHU45r66FSP1FeqjCv9dwGx5qkF9OSM0g9bsObdahldQ1nS1xdV+Zg/RkVSAeeMmrFqg3tTPLslRbckDW6kj/F/KZaiqrAjjK25REMjcEv9aRg8lBiwqvxLcAev6Kd3KKH27rlqH3WhbrYBe4AUFw7kNgjPQ3gIX8jf0HJOl3PZO32FuJksQfjvO7xW94sXC0BUbXrszZ+WDKMY4rmN2YGHflE9L+yChq/DpKSuG2eahqLb915osWahSDd2RQ27aQ3SDXwd8jKwAjpxKR0FWxp8yLDgoIUFJwWJBjyun+4f+qXLE5Zvz1B1z6f06I+VMwQWjNMPo9JeA5iuyL5O+wVYDlpBsoUnY38Vsw6vLYmQNb8nnGfo1Sonu5W9O3gUTVNKVDB6F4qJLDLCgVVWXdmJGvC8qVg3n+ggbT/5yiMh6nmaLeqLMPZZViMn52jAVbIJQvcWTvttUwdH9Qpf3m7aJdpP834XPcvnrWSBg4TyOdG/M5SyJFFXDIgFQNsj6UoGEqADDi9pB1eAO/iwGGB7tciD4x/yrkHgqMd0XJPDOVZzr1h2v7IHhOtbh3szXcaGJNTwMqiwC6ihtgips1MJahpaky73VUDMWcnggoaTSOOJvEPZ8SNhgyec0wj6UhpDp9uJYbdxWFcf8ad97l9EesoyfOzIbyoS7SqpFDS/+JZFvb7MaZV8v3AQkJkr/SWs74vz3Nng6rbF8IANK7yDuoEf8LmwwZJtbXoCaZmsERt73ZprdRWztDX4n7PdF/7mJ37yVg/W4+2vPm8FqQ5BE1BwcgwTNd7/QJyhNTcNvm/BDIgZ4o/78KhQUxRsiBP85ck2WcvDf9hKlS+xixom7qY4PazAVWMRhvefg99ANuj1r3o38sTMlYOf",
        "name": "BlinkLED"
      }
    ]
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "deviceTypes": {
          "items": {
            "type": "object",
            "properties": {
              "description": {
                "description": "Name of device type",
                "type": "string"
              }
            }
          },
          "type": "array"
        },
        "dataCollectors": {
          "items": {
            "type": "object",
            "properties": {
              "deviceTypes": {
                "items": {
                  "description": "Description of device type",
                  "type": "string"
                },
                "type": "array"
              },
              "initRpcName": {
                "description": "Name of function implemented by SNAPpy script (async only)",
                "type": "string"
              },
              "name": {
                "description": "Name of data collector",
                "type": "string"
              },
              "dataCollectorType": {
                "description": "Data collector type, one of 'synchronous' or 'asynchronous'",
                "type": "string"
              },
              "href": {
                "description": "URI for this data collector resource",
                "type": "string"
              },
              "queryFunction": {
                "description": "Name of query function (sync only)",
                "type": "string"
              },
              "dataRpcName": {
                "description": "Name of the RPC that the receiver will listen on for new data (async only)",
                "type": "string"
              },
              "pollInterval": {
                "description": "Number of seconds between polls (sync only)",
                "type": "integer"
              }
            }
          },
          "type": "array"
        },
        "images": {
          "items": {
            "type": "object",
            "properties": {
              "crc": {
                "description": "Checksum of SPY image content",
                "type": "string"
              },
              "size": {
                "description": "Image size in bytes",
                "type": "integer"
              },
              "id": {
                "description": "Unique identifier for this SPY image resource",
                "type": "string"
              },
              "file": {
                "description": "SPY image content",
                "type": "string"
              },
              "name": {
                "description": "The script name compiled into the SPY image",
                "type": "string"
              }
            }
          },
          "type": "array"
        }
      }
    }
  }
}

Import site configuration
POST/api/v1/siteConfig

Example URI

POST /api/v1/siteConfig
Request
HideShow
Body
{}
Schema
{
  "required": [
    "deviceTypes",
    "dataCollectors",
    "images"
  ],
  "type": "object",
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "deviceTypes": {
      "description": {
        "description": "Device types",
        "type": "object"
      }
    },
    "dataCollectors": {
      "description": {
        "description": "Data collectors",
        "type": "object"
      }
    },
    "images": {
      "description": {
        "description": "Images",
        "type": "object"
      }
    }
  }
}
Response  201
HideShow

The site configuration was successfully imported.

Body
{
  "deviceTypes": [
    {
      "description": "a device type description"
    },
    {
      "description": "another device type description"
    }
  ],
  "dataCollectors": [
    {
      "dataCollectorType": "asynchronous",
      "deviceTypes": [
        "sensors"
      ],
      "initRpcName": "setReceiverAddress",
      "name": "dc1",
      "dataRpcName": "acceptData"
    },
    {
      "dataCollectorType": "synchronous",
      "deviceTypes": [
        "lights"
      ],
      "queryFunction": "data",
      "name": "dc2",
      "pollInterval": 60
    }
  ],
  "images": [
    {
      "crc": "0xda95",
      "size": 3489,
      "id": "46fed882-98da-497f-8400-9c92f4c66bb0",
      "file": "/d9CprNlBqsxQ8oJ+23SCfkIrXOaoUIaxHNoVK5xo3FLuS9uDXBRO1ommFU6wmMvssqK13qPGMFBe7gc/IaZY8c6fK0KnAgY/WPZWAsQGi1xDP+L7hoi8J0lts3BCJ1czjzCE9y4H176wcKqyezON3FW/0HvYJG9WpgR18eKFe6mW3ylE5QAltxIQG8jQBlXsOU82J7G8mdsds9prCbC8A2Vqiekmgza4Q7l6MnStBilePZxqhYipsWnifMiq4UsHatKcnfZd7ohnf49wQLMS8h1t3R/WYcYfJy7VSso8g6wJ8K5LRv1l3AH1qE9ohJERfc7C1aWAq/ApYIVTBxcFt6yuytjskB1QWoXoQ6l+9qmR//H8KiQbWcw6D/j5FBW61Py1ZHU45r66FSP1FeqjCv9dwGx5qkF9OSM0g9bsObdahldQ1nS1xdV+Zg/RkVSAeeMmrFqg3tTPLslRbckDW6kj/F/KZaiqrAjjK25REMjcEv9aRg8lBiwqvxLcAev6Kd3KKH27rlqH3WhbrYBe4AUFw7kNgjPQ3gIX8jf0HJOl3PZO32FuJksQfjvO7xW94sXC0BUbXrszZ+WDKMY4rmN2YGHflE9L+yChq/DpKSuG2eahqLb915osWahSDd2RQ27aQ3SDXwd8jKwAjpxKR0FWxp8yLDgoIUFJwWJBjyun+4f+qXLE5Zvz1B1z6f06I+VMwQWjNMPo9JeA5iuyL5O+wVYDlpBsoUnY38Vsw6vLYmQNb8nnGfo1Sonu5W9O3gUTVNKVDB6F4qJLDLCgVVWXdmJGvC8qVg3n+ggbT/5yiMh6nmaLeqLMPZZViMn52jAVbIJQvcWTvttUwdH9Qpf3m7aJdpP834XPcvnrWSBg4TyOdG/M5SyJFFXDIgFQNsj6UoGEqADDi9pB1eAO/iwGGB7tciD4x/yrkHgqMd0XJPDOVZzr1h2v7IHhOtbh3szXcaGJNTwMqiwC6ihtgips1MJahpaky73VUDMWcnggoaTSOOJvEPZ8SNhgyec0wj6UhpDp9uJYbdxWFcf8ad97l9EesoyfOzIbyoS7SqpFDS/+JZFvb7MaZV8v3AQkJkr/SWs74vz3Nng6rbF8IANK7yDuoEf8LmwwZJtbXoCaZmsERt73ZprdRWztDX4n7PdF/7mJ37yVg/W4+2vPm8FqQ5BE1BwcgwTNd7/QJyhNTcNvm/BDIgZ4o/78KhQUxRsiBP85ck2WcvDf9hKlS+xixom7qY4PazAVWMRhvefg99ANuj1r3o38sTMlYOf",
      "name": "MCastCounter"
    },
    {
      "crc": "0xda95",
      "size": 2785,
      "id": "12abc882-98da-497f-8400-9c92f4c66bb0",
      "file": "/d9CprNlBqsxQ8oJ+23SCfkIrXOaoUIaxHNoVK5xo3FLuS9uDXBRO1ommFU6wmMvssqK13qPGMFBe7gc/IaZY8c6fK0KnAgY/WPZWAsQGi1xDP+L7hoi8J0lts3BCJ1czjzCE9y4H176wcKqyezON3FW/0HvYJG9WpgR18eKFe6mW3ylE5QAltxIQG8jQBlXsOU82J7G8mdsds9prCbC8A2Vqiekmgza4Q7l6MnStBilePZxqhYipsWnifMiq4UsHatKcnfZd7ohnf49wQLMS8h1t3R/WYcYfJy7VSso8g6wJ8K5LRv1l3AH1qE9ohJERfc7C1aWAq/ApYIVTBxcFt6yuytjskB1QWoXoQ6l+9qmR//H8KiQbWcw6D/j5FBW61Py1ZHU45r66FSP1FeqjCv9dwGx5qkF9OSM0g9bsObdahldQ1nS1xdV+Zg/RkVSAeeMmrFqg3tTPLslRbckDW6kj/F/KZaiqrAjjK25REMjcEv9aRg8lBiwqvxLcAev6Kd3KKH27rlqH3WhbrYBe4AUFw7kNgjPQ3gIX8jf0HJOl3PZO32FuJksQfjvO7xW94sXC0BUbXrszZ+WDKMY4rmN2YGHflE9L+yChq/DpKSuG2eahqLb915osWahSDd2RQ27aQ3SDXwd8jKwAjpxKR0FWxp8yLDgoIUFJwWJBjyun+4f+qXLE5Zvz1B1z6f06I+VMwQWjNMPo9JeA5iuyL5O+wVYDlpBsoUnY38Vsw6vLYmQNb8nnGfo1Sonu5W9O3gUTVNKVDB6F4qJLDLCgVVWXdmJGvC8qVg3n+ggbT/5yiMh6nmaLeqLMPZZViMn52jAVbIJQvcWTvttUwdH9Qpf3m7aJdpP834XPcvnrWSBg4TyOdG/M5SyJFFXDIgFQNsj6UoGEqADDi9pB1eAO/iwGGB7tciD4x/yrkHgqMd0XJPDOVZzr1h2v7IHhOtbh3szXcaGJNTwMqiwC6ihtgips1MJahpaky73VUDMWcnggoaTSOOJvEPZ8SNhgyec0wj6UhpDp9uJYbdxWFcf8ad97l9EesoyfOzIbyoS7SqpFDS/+JZFvb7MaZV8v3AQkJkr/SWs74vz3Nng6rbF8IANK7yDuoEf8LmwwZJtbXoCaZmsERt73ZprdRWztDX4n7PdF/7mJ37yVg/W4+2vPm8FqQ5BE1BwcgwTNd7/QJyhNTcNvm/BDIgZ4o/78KhQUxRsiBP85ck2WcvDf9hKlS+xixom7qY4PazAVWMRhvefg99ANuj1r3o38sTMlYOf",
      "name": "BlinkLED"
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "deviceTypes": {
          "items": {
            "type": "object",
            "properties": {
              "description": {
                "description": "Name of device type",
                "type": "string"
              }
            }
          },
          "type": "array"
        },
        "dataCollectors": {
          "items": {
            "type": "object",
            "properties": {
              "deviceTypes": {
                "items": {
                  "description": "Description of device type",
                  "type": "string"
                },
                "type": "array"
              },
              "initRpcName": {
                "description": "Name of function implemented by SNAPpy script (async only)",
                "type": "string"
              },
              "name": {
                "description": "Name of data collector",
                "type": "string"
              },
              "dataCollectorType": {
                "description": "Data collector type, one of 'synchronous' or 'asynchronous'",
                "type": "string"
              },
              "href": {
                "description": "URI for this data collector resource",
                "type": "string"
              },
              "queryFunction": {
                "description": "Name of query function (sync only)",
                "type": "string"
              },
              "dataRpcName": {
                "description": "Name of the RPC that the receiver will listen on for new data (async only)",
                "type": "string"
              },
              "pollInterval": {
                "description": "Number of seconds between polls (sync only)",
                "type": "integer"
              }
            }
          },
          "type": "array"
        },
        "images": {
          "items": {
            "type": "object",
            "properties": {
              "crc": {
                "description": "Checksum of SPY image content",
                "type": "string"
              },
              "size": {
                "description": "Image size in bytes",
                "type": "integer"
              },
              "id": {
                "description": "Unique identifier for this SPY image resource",
                "type": "string"
              },
              "href": {
                "description": "URI for this SPY image resource",
                "type": "string"
              },
              "name": {
                "description": "The script name compiled into the SPY image",
                "type": "string"
              }
            }
          },
          "type": "array"
        }
      }
    }
  }
}
Response  400
HideShow

Site configuration could not be imported with these attributes.

Body
{
  "error": {
    "message": "Site configuration could not be imported with these attributes"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

SPY Images

SPY Image Collection

Get all SPY images
GET/api/v1/images

Example URI

GET /api/v1/images
Response  200
HideShow

List all images.If no SPY images have been uploaded, the response contains an empty array.

Body
{
  "data": [
    {
      "crc": "0xda95",
      "size": 3489,
      "id": "6f992502-33f0-47d4-a01e-973593e1915d",
      "href": "https://localhost:3000/api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d",
      "name": "McastCounter"
    },
    {
      "crc": "0x16f1",
      "size": 690,
      "id": "f97fdf18-fede-4d58-96d4-eb3f36b4b872",
      "href": "https://localhost:3000/api/v1/images/f97fdf18-fede-4d58-96d4-eb3f36b4b872",
      "name": "blink"
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "type": "object",
        "properties": {
          "crc": {
            "description": "Checksum of SPY image content",
            "type": "string"
          },
          "size": {
            "description": "Image size in bytes",
            "type": "integer"
          },
          "id": {
            "description": "Unique identifier for this SPY image resource",
            "type": "string"
          },
          "href": {
            "description": "URI for this SPY image resource",
            "type": "string"
          },
          "name": {
            "description": "The script name compiled into the SPY image",
            "type": "string"
          }
        }
      },
      "type": "array"
    }
  }
}

Create a new SPY image
POST/api/v1/images

You must create a SPY image resource in the service before it can be uploaded to a SNAP device. To create a SPY image resource, obtain the Base64-encoded representation of the SPY image data and pass it in as the content property’s value for this request.

Example URI

POST /api/v1/images
Request
HideShow
Body
{
  "content": "<Base64-encoded SPY file contents>"
}
Schema
{
  "required": [
    "content"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "content": {
      "description": "Base64-encoded SPY image contents",
      "type": "string",
      "media": {
        "type": "octet-stream",
        "binaryEncoding": "base64"
      }
    }
  },
  "description": "A SPY file image",
  "title": "Upload SPY image",
  "type": "object"
}
Response  201
HideShow

Successfully created image.

Headers
Location: https://localhost:3000/api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d
Body
{
  "data": {
    "crc": "0xda95",
    "size": 3489,
    "id": "6f992502-33f0-47d4-a01e-973593e1915d",
    "href": "https://localhost:3000/api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d",
    "name": "McastCounter"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "crc": {
          "description": "Checksum of SPY image content",
          "type": "string"
        },
        "size": {
          "description": "Image size in bytes",
          "type": "integer"
        },
        "id": {
          "description": "Unique identifier for this SPY image resource",
          "type": "string"
        },
        "href": {
          "description": "URI for this SPY image resource",
          "type": "string"
        },
        "name": {
          "description": "The script name compiled into the SPY image",
          "type": "string"
        }
      }
    }
  }
}

Delete all SPY images
DELETE/api/v1/images

Example URI

DELETE /api/v1/images
Response  204
HideShow

Successfully deleted all images.

SPY Image

Get a single SPY image
GET/api/v1/images/{imageId}

Example URI

GET /api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d
URI Parameters
HideShow
imageId
string (required) Example: 6f992502-33f0-47d4-a01e-973593e1915d

Unique identifier for a SPY image.

Response  200
HideShow

Get image details.

Body
{
  "data": {
    "crc": "0xda95",
    "size": 3489,
    "id": "6f992502-33f0-47d4-a01e-973593e1915d",
    "href": "https://localhost:3000/api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d",
    "name": "McastCounter"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "type": "object",
        "properties": {
          "crc": {
            "description": "Checksum of SPY image content",
            "type": "string"
          },
          "size": {
            "description": "Image size in bytes",
            "type": "integer"
          },
          "id": {
            "description": "Unique identifier for this SPY image resource",
            "type": "string"
          },
          "href": {
            "description": "URI for this SPY image resource",
            "type": "string"
          },
          "name": {
            "description": "The script name compiled into the SPY image",
            "type": "string"
          }
        }
      },
      "type": "array"
    }
  }
}
Response  404
HideShow

No SPY image found for this identifier.

Body
{
  "error": {
    "message": "Image could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Delete a SPY image
DELETE/api/v1/images/{imageId}

Example URI

DELETE /api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d
URI Parameters
HideShow
imageId
string (required) Example: 6f992502-33f0-47d4-a01e-973593e1915d

Unique identifier for a SPY image.

Response  204
HideShow

Successfully deleted image.

Response  404
HideShow

No SPY image found for this identifier.

Body
{
  "error": {
    "message": "Image could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Synapse RF Module Types

Synapse RF Module Type Collection

Get Module Types
GET/api/v1/moduleTypes

Example URI

GET /api/v1/moduleTypes
Response  200
HideShow

List all Synapse RF module types.

Body
{
  "data": [
    {
      "href": "https://localhost:3000/api/v1/moduleTypes/RF200PF1",
      "partName": "RF200PF1"
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "type": "object",
        "properties": {
          "href": {
            "description": "URI for this Synapse RF Module Type",
            "type": "string"
          },
          "partName": {
            "description": "Synapse RF Module Type Part Name",
            "type": "string"
          }
        }
      },
      "type": "array"
    }
  }
}

Network Configuration

Network Configurations Collection

Get a List of All Network Configurations
GET/api/v1/networkConfigurations

Example URI

GET /api/v1/networkConfigurations
Response  200
HideShow

List all network configurations.

Body
{
  "data": [
    {
      "id": "7e968754-78f0-09f8-b57b-968745b2789e",
      "href": "https://localhost:3000/api/v1/networkConfigurations/7e968754-78f0-09f8-b57b-968745b2789e",
      "deviceGroupConfigurations": [
        {
          "configuration": {
            "image": {
              "href": "https://localhost:3000/api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d"
            }
          },
          "devices": [
            "03cd71",
            "04ab44"
          ]
        },
        {
          "configuration": {
            "image": {
              "href": "https://localhost:3000/api/v1/images/4a2fd398-3a66-49c0-9126-98c901cd6ee4"
            }
          },
          "devices": [
            "00a400",
            "040128"
          ]
        }
      ]
    },
    {
      "id": "c5fe2546-78f0-09f8-b57b-968745b2789e",
      "href": "https://localhost:3000/api/v1/networkConfigurations/c5fe2546-78f0-09f8-b57b-968745b2789e",
      "deviceGroupConfigurations": [
        {
          "configuration": {
            "image": {
              "href": "https://localhost:3000/api/v1/images/4d271412-33f0-47d4-a01e-973593e1915d"
            }
          },
          "devices": [
            "082614",
            "7531df"
          ]
        },
        {
          "configuration": {
            "image": {
              "href": "https://localhost:3000/api/v1/images/9e524135-3a66-49c0-9126-98c901cd6ee4"
            }
          },
          "devices": [
            "04abaf",
            "604def"
          ]
        }
      ]
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "description": "A network configuration resource",
        "type": "object",
        "properties": {
          "id": {
            "description": "Unique identifier for this network configuration resource",
            "type": "string"
          },
          "href": {
            "description": "URI for this network configuration resource",
            "type": "string"
          },
          "deviceGroupConfigurations": {
            "items": {
              "description": "Associates a configuration with a group of devices",
              "type": "object",
              "properties": {
                "configuration": {
                  "description": "A configuration that can be applied to one or more devices",
                  "type": "object",
                  "properties": {
                    "image": {
                      "description": "A SPY image",
                      "type": "object",
                      "properties": {
                        "href": {
                          "description": "Location",
                          "type": "string"
                        }
                      }
                    },
                    "firmware": {
                      "description": "A SNAP firmware release",
                      "type": "object",
                      "properties": {
                        "href": {
                          "description": "Location",
                          "type": "string"
                        }
                      }
                    }
                  }
                },
                "devices": {
                  "description": "A group of devices",
                  "items": {
                    "description": "SNAP MAC address",
                    "type": "string",
                    "pattern": "^(00[.:]?1[cC][.:]?2[cC][.:]?[0-9a-fA-F]{2}[.:]?[0-9a-fA-F]{2}[.:]?)?([0-9a-fA-F][.:]?){5}[0-9a-fA-F]$",
                    "pattern_description": "A valid SNAP address must be a hex value of at least 6 digits with optional period or colon delimiters (ex: 'a18ca9', '04:3E:82')."
                  },
                  "type": "array",
                  "uniqueItems": true
                }
              }
            },
            "type": "array"
          }
        }
      },
      "type": "array"
    }
  }
}

Create a Network Configuration
POST/api/v1/networkConfigurations

Describe a desired network configuration in terms of some number of device group-specific configurations.

Example URI

POST /api/v1/networkConfigurations
Request
HideShow
Body
{
  "deviceGroupConfigurations": [
    {
      "configuration": {
        "image": {
          "href": "https://localhost:3000/api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d"
        }
      },
      "devices": [
        "03cd71",
        "04ab44"
      ]
    },
    {
      "configuration": {
        "image": {
          "href": "https://localhost:3000/api/v1/images/4a2fd398-3a66-49c0-9126-98c901cd6ee4"
        }
      },
      "devices": [
        "00a400",
        "040128"
      ]
    }
  ]
}
Schema
{
  "required": [
    "deviceGroupConfigurations"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "deviceGroupConfigurations": {
      "items": {
        "description": "Associates a configuration with a group of devices",
        "required": [
          "devices"
        ],
        "type": "object",
        "properties": {
          "configuration": {
            "description": "A configuration that can be applied to one or more devices",
            "type": "object",
            "properties": {
              "image": {
                "description": "A SPY image",
                "type": "object",
                "properties": {
                  "href": {
                    "description": "Location",
                    "type": "string"
                  }
                }
              },
              "firmware": {
                "description": "A SNAP firmware release",
                "type": "object",
                "properties": {
                  "href": {
                    "description": "Location",
                    "type": "string"
                  }
                }
              }
            }
          },
          "devices": {
            "description": "A group of devices",
            "items": {
              "description": "SNAP MAC address",
              "type": "string",
              "pattern": "^(00[.:]?1[cC][.:]?2[cC][.:]?[0-9a-fA-F]{2}[.:]?[0-9a-fA-F]{2}[.:]?)?([0-9a-fA-F][.:]?){5}[0-9a-fA-F]$",
              "pattern_description": "A valid SNAP Address must be a hex value of at least 6 digits with optional period or colon delimiters (ex:\"a18ca9\", \"04:3E:82\")."
            },
            "type": "array",
            "uniqueItems": true
          }
        }
      },
      "type": "array"
    }
  },
  "description": "A network configuration resource",
  "title": "Add network configuration",
  "type": "object"
}
Response  201
HideShow

Successfully created network configuration.

Headers
Location: https://localhost:3000/api/v1/networkConfigurations/7e968754-78f0-09f8-b57b-968745b2789e
Body
{
  "data": {
    "id": "7e968754-78f0-09f8-b57b-968745b2789e",
    "href": "https://localhost:3000/api/v1/networkConfigurations/7e968754-78f0-09f8-b57b-968745b2789e",
    "deviceGroupConfigurations": [
      {
        "configuration": {
          "image": {
            "href": "https://localhost:3000/api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d"
          }
        },
        "devices": [
          "03cd71",
          "04ab44"
        ]
      },
      {
        "configuration": {
          "image": {
            "href": "https://localhost:3000/api/v1/images/4a2fd398-3a66-49c0-9126-98c901cd6ee4"
          }
        },
        "devices": [
          "00a400",
          "040128"
        ]
      }
    ]
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "description": "A network configuration resource",
      "required": [
        "deviceGroupConfigurations"
      ],
      "type": "object",
      "properties": {
        "id": {
          "description": "Unique identifier for this network configuration resource",
          "type": "string"
        },
        "href": {
          "description": "URI for this network configuration resource",
          "type": "string"
        },
        "deviceGroupConfigurations": {
          "items": {
            "description": "Associates a configuration with a group of devices",
            "required": [
              "devices"
            ],
            "type": "object",
            "properties": {
              "configuration": {
                "description": "A configuration that can be applied to one or more devices",
                "type": "object",
                "properties": {
                  "image": {
                    "description": "A SPY image",
                    "type": "object",
                    "properties": {
                      "href": {
                        "description": "Location",
                        "type": "string"
                      }
                    }
                  },
                  "firmware": {
                    "description": "A SNAP firmware release",
                    "type": "object",
                    "properties": {
                      "href": {
                        "description": "Location",
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "devices": {
                "description": "A group of devices",
                "items": {
                  "description": "SNAP MAC address",
                  "type": "string",
                  "pattern": "^(00[.:]?1[cC][.:]?2[cC][.:]?[0-9a-fA-F]{2}[.:]?[0-9a-fA-F]{2}[.:]?)?([0-9a-fA-F][.:]?){5}[0-9a-fA-F]$",
                  "pattern_description": "A valid SNAP address must be a hex value of at least 6 digits with optional period or colon delimiters (ex: 'a18ca9', '04:3E:82')."
                },
                "type": "array",
                "uniqueItems": true
              }
            }
          },
          "type": "array"
        }
      }
    }
  }
}

Network Configuration

Get a Network Configuration
GET/api/v1/networkConfigurations/{networkConfigurationId}

Example URI

GET /api/v1/networkConfigurations/7e968754-78f0-09f8-b57b-968745b2789e
URI Parameters
HideShow
networkConfigurationId
string (required) Example: 7e968754-78f0-09f8-b57b-968745b2789e

Unique identifier for a network configuration resource.

Response  200
HideShow

Get network configuration details.

Body
{
  "data": {
    "id": "7e968754-78f0-09f8-b57b-968745b2789e",
    "href": "https://localhost:3000/api/v1/networkConfigurations/7e968754-78f0-09f8-b57b-968745b2789e",
    "deviceGroupConfigurations": [
      {
        "configuration": {
          "image": {
            "href": "https://localhost:3000/api/v1/images/6f992502-33f0-47d4-a01e-973593e1915d"
          }
        },
        "devices": [
          "03cd71",
          "04ab44"
        ]
      },
      {
        "configuration": {
          "image": {
            "href": "https://localhost:3000/api/v1/images/4a2fd398-3a66-49c0-9126-98c901cd6ee4"
          }
        },
        "devices": [
          "00a400",
          "040128"
        ]
      }
    ]
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "description": "A network configuration resource",
      "required": [
        "deviceGroupConfigurations"
      ],
      "type": "object",
      "properties": {
        "id": {
          "description": "Unique identifier for this network configuration resource",
          "type": "string"
        },
        "href": {
          "description": "URI for this network configuration resource",
          "type": "string"
        },
        "deviceGroupConfigurations": {
          "items": {
            "description": "Associates a configuration with a group of devices",
            "required": [
              "devices"
            ],
            "type": "object",
            "properties": {
              "configuration": {
                "description": "A configuration that can be applied to one or more devices",
                "type": "object",
                "properties": {
                  "image": {
                    "description": "A SPY image",
                    "type": "object",
                    "properties": {
                      "href": {
                        "description": "Location",
                        "type": "string"
                      }
                    }
                  },
                  "firmware": {
                    "description": "A SNAP firmware release",
                    "type": "object",
                    "properties": {
                      "href": {
                        "description": "Location",
                        "type": "string"
                      }
                    }
                  }
                }
              },
              "devices": {
                "description": "A group of devices",
                "items": {
                  "description": "SNAP MAC address",
                  "type": "string",
                  "pattern": "^(00[.:]?1[cC][.:]?2[cC][.:]?[0-9a-fA-F]{2}[.:]?[0-9a-fA-F]{2}[.:]?)?([0-9a-fA-F][.:]?){5}[0-9a-fA-F]$",
                  "pattern_description": "A valid SNAP address must be a hex value of at least 6 digits with optional period or colon delimiters (ex: 'a18ca9', '04:3E:82')."
                },
                "type": "array",
                "uniqueItems": true
              }
            }
          },
          "type": "array"
        }
      }
    }
  }
}
Response  404
HideShow

No network configuration resource found for this identifier.

Body
{
  "error": {
    "message": "Network configuration resource could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Network Configuration Updates

Network Configuration Updates Collection

Initiate a Network Configuration Update
POST/api/v1/networkConfigurationUpdates

A POST to this endpoint initiates a network configuration update, using the specified network configuration as the “recipe”. This is an asynchronous process that may take awhile to complete, so it immediately returns a 202 status (“Accepted”) and the location of a task resource that indicates the current status of this long-running update task.

Once a network configuration update is complete, the affected devices will be updated with their new firmware or script versions (assuming those updates were successful).

Example URI

POST /api/v1/networkConfigurationUpdates
Request
HideShow
Body
{
  "href": "https://localhost:3000/api/v1/networkConfigurations/7e968754-78f0-09f8-b57b-968745b2789e"
}
Schema
{
  "required": [
    "href"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "href": {
      "description": "The location of a network configuration",
      "type": "string"
    }
  },
  "description": "A network configuration location",
  "title": "Apply a network configuration update",
  "type": "object"
}
Response  202
HideShow

Accepted network configuration update for processing.

Headers
Location: https://localhost:3000/api/v1/tasks/8ba8d8bd-edeb-4960-bb05-87c75697bf6d
Response  400
HideShow

A network configuration update will not start if any number of errors are detected in the network configuration description (e.g. if the network configuration refers to unrecognized device MAC addresses). The message property of the error response should provide more details.

Body
{
  "error": {
    "message": "Unable to update network configuration: No devices found with address 608477"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  403
HideShow

A network configuration update will not start if the network configuration description identifies multiple devices but the user’s license restricts them to upgrading only one device at a time.

Body
{
  "error": {
    "message": "Your license only permits upgrading one device at a time. Please contact your sales representative to discuss upgrading your license to support upgrading multiple device at the same time."
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}
Response  404
HideShow

If the HREF in the message body refers to a non-existent network configuration, the response is 404 (Not Found).

Body
{
  "error": {
    "message": "Network configuration could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Network Configuration Updates

Get results of a network configuration update
GET/api/v1/networkConfigurationUpdates/{networkConfigurationUpdateId}

Assuming the associated task of updating the network configuration is complete, this endpoint returns the results of that task. The results are group into firmware update results and image update results, on a device-by-device basis. If the attempted update of firmware or image for a device failed, the result value will be “failure”. If the update was successful, or if no update was attempted, the result value will be “success”.

Example URI

GET /api/v1/networkConfigurationUpdates/7e968754-78f0-09f8-b57b-968745b2789e
URI Parameters
HideShow
networkConfigurationUpdateId
string (required) Example: 7e968754-78f0-09f8-b57b-968745b2789e

Unique identifier for a network configuration update result.

Response  200
HideShow

Get network configuration update results.

Body
{
  "data": {
    "image_results": [
      {
        "result": "success",
        "address": "60866a"
      },
      {
        "result": "success",
        "address": "608477"
      }
    ],
    "id": "9496aed3-1614-4207-8883-2c807958d940",
    "firmware_results": [
      {
        "result": "failure",
        "address": "60866a"
      },
      {
        "result": "success",
        "address": "608477"
      }
    ],
    "href": "https://localhost:3000/api/v1/networkConfigurationUpdates/9496aed3-1614-4207-8883-2c807958d940"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "image_results": {
          "items": {
            "type": "object",
            "properties": {
              "result": {
                "description": "Outcome of the attempted update, either success or failure",
                "type": "string"
              },
              "address": {
                "description": "MAC address for the device described in this result",
                "type": "string"
              }
            }
          },
          "type": "array"
        },
        "id": {
          "description": "Unique identifier for this results set",
          "type": "string"
        },
        "firmware_results": {
          "items": {
            "type": "object",
            "properties": {
              "result": {
                "description": "Outcome of the attempted update, either success or failure",
                "type": "string"
              },
              "address": {
                "description": "MAC address for the device described in this result",
                "type": "string"
              }
            }
          },
          "type": "array"
        },
        "href": {
          "description": "URI for this network configuration update results resource",
          "type": "string"
        }
      }
    }
  }
}
Response  404
HideShow

No such results.

Body
{
  "error": {
    "message": "Network configuration update results could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Sockets

SockJS Endpoint

Connect SockJS
GET/ws

See http://sockjs.org for details on making a connection.

Example URI

GET /ws
Response  200
HideShow
Body
"Established SockJS Connection"

Websocket Endpoint

Connect Websocket
GET/ws/websocket

Example URI

GET /ws/websocket
Response  200
HideShow
Body
"Established Websocket Connection"

Tasks

Task

Get task status
GET/api/v1/tasks/{taskId}

A task resource is primarily useful as a handle for a long-running process, such as updating the firmware on a group of devices, or computing the topology for a SNAP mesh network. If the response to a GET request for a task returns HTTP status 200 (OK), the client can assume that this task is still in progress. If the response to a GET request is HTTP status 303 (See Other), the Location header of the response indicates the URI for the results of this task. (Note that some HTTP clients will automatically redirect the client to this location.)

Example URI

GET /api/v1/tasks/7e968754-78f0-09f8-b57b-968745b2789e
URI Parameters
HideShow
taskId
string (required) Example: 7e968754-78f0-09f8-b57b-968745b2789e

Unique identifier for a task.

Response  200
HideShow

This long-running task (e.g. a network configuration update, or topology generation) is still in progress.

Body
{
  "data": {
    "id": "8ba8d8bd-edeb-4960-bb05-87c75697bf6d",
    "href": "https://localhost:3000/api/v1/tasks/8ba8d8bd-edeb-4960-bb05-87c75697bf6d"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "description": "Unique identifier for this task",
          "type": "string"
        },
        "href": {
          "description": "URI of this task resource",
          "type": "string"
        }
      }
    }
  }
}
Response  303
HideShow

This task is complete, and the Location header indicates where to find the results of this task.

Headers
Location: https://localhost:3000/api/v1/networkConfigurationUpdates/9496aed3-1614-4207-8883-2c807958d940
Response  404
HideShow

No task found for this identifier.

Body
{
  "error": {
    "message": "Task could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

TCP Access

TCP Access

Handles requests to enable or disable SNAPconnect TCP access.

Get TCP access state
GET/api/v1/tcpAccess

Example URI

GET /api/v1/tcpAccess
Response  200
HideShow

Get TCP access details.

Body
{
  "data": {
    "tcpAccessEnabled": true
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "tcpAccessEnabled": {
          "description": "Indicates whether TCP access is enabled",
          "type": "boolean"
        }
      }
    }
  }
}

Enable TCP access
POST/api/v1/tcpAccess

Example URI

POST /api/v1/tcpAccess
Request
HideShow
Body
{
  "password": "Synapse$0123",
  "username": "snap"
}
Schema
{
  "required": [
    "username",
    "password"
  ],
  "$schema": "http://json-schema.org/draft-04/schema#",
  "properties": {
    "password": {
      "description": "Password for the TCP connection",
      "type": "string",
      "minLength": 1
    },
    "username": {
      "description": "Username for the TCP connection",
      "type": "string",
      "minLength": 1
    }
  },
  "description": "A device type",
  "title": "Add device type",
  "type": "object"
}
Response  201
HideShow

Successfully opened TCP connection

Response  409
HideShow

TCP access has already been enabled.

Body
{
  "error": {
    "message": "TCP access has already been enabled"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Disable TCP access
DELETE/api/v1/tcpAccess

Disabling TCP access will prevent new connections but not close existing ones.

Example URI

DELETE /api/v1/tcpAccess
Response  204
HideShow

Successfully disabled TCP

Topologies

SNAP Network Topology Collection

Get all topologies
GET/api/v1/topologies

Returns an array of the previously generated topologies.

Topology results are limited to 5 nodes when using a trial license. Please contact your sales representative to discuss upgrading your license to support retrieving full topology results.

Example URI

GET /api/v1/topologies
Response  200
HideShow

List all topologies.

Body
{
  "data": [
    {
      "id": "525a2d06-bfa4-4ad5-b3a1-c614bc367d9c",
      "createdAt": "2016-07-27T13:57:43.361554Z",
      "href": "https://localhost:3000/api/v1/topologies/525a2d06-bfa4-4ad5-b3a1-c614bc367d9c",
      "gateways": [
        "608509"
      ],
      "links": [
        {
          "start": "608509",
          "end": "5ecad4",
          "linkQuality": 71
        },
        {
          "start": "5ecad4",
          "end": "608509",
          "linkQuality": 68
        }
      ]
    }
  ]
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "description": "Unique identifier for this topology resource",
            "type": "string"
          },
          "createdAt": {
            "description": "Topology creation date (ISO8601 format)",
            "type": "string"
          },
          "href": {
            "description": "URI for this topology resource",
            "type": "string"
          },
          "gateways": {
            "items": {
              "description": "Gateway MAC address",
              "type": "string"
            },
            "type": "array"
          },
          "links": {
            "items": {
              "type": "object",
              "properties": {
                "start": {
                  "description": "Start address for this link",
                  "type": "string"
                },
                "end": {
                  "description": "End address for this link",
                  "type": "string"
                },
                "linkQuality": {
                  "description": "Link quality for this link (-dBm)",
                  "type": "integer"
                }
              }
            },
            "type": "array"
          }
        }
      },
      "type": "array"
    }
  }
}

Initiate Generation of the SNAP Network Topology
POST/api/v1/topologies

A POST to this endpoint initiates generation of the SNAP network topology. This is an asynchronous process that may take awhile to complete, depending on the number of nodes in your network, so it immediately returns a 202 status (“Accepted”) and the location of a task resource that indicates the current status of this long-running task. Clients can poll this task to determine when it has completed, and where to find the topology results.

Example URI

POST /api/v1/topologies
Response  202
HideShow

Accepted topology for processing.

Headers
Location: https://localhost:3000/api/v1/tasks/83f4e242-e89d-407b-95e5-a5a603427217

Delete all topologies
DELETE/api/v1/topologies

Delete from storage all previously generated topologies.

Example URI

DELETE /api/v1/topologies
Response  204
HideShow

Successfully deleted all topologies.

SNAP Network Topology

Get topology
GET/api/v1/topologies/{topologyId}

Returns information about this previously generated topology. The mesh network topology is represented in terms of an array of links, where each link is described by its starting and ending SNAP node address as well as the link quality (in -dBm) between those two nodes.

Note that because the link quality is reported in units of -dBm, small values of link quality (closer to zero) indicate high link quality, while larger values (e.g. greater than 80) indicate low link quality.

Topology results are limited to 5 nodes when using a trial license. Please contact your sales representative to discuss upgrading your license to support retrieving full topology results.

Example URI

GET /api/v1/topologies/525a2d06-bfa4-4ad5-b3a1-c614bc367d9c
URI Parameters
HideShow
topologyId
string (required) Example: 525a2d06-bfa4-4ad5-b3a1-c614bc367d9c

Unique identifier for a topology, or latest to refer to the topology with the most recent createdAt timestamp.

Response  200
HideShow

Get topology details.

Body
{
  "data": {
    "id": "525a2d06-bfa4-4ad5-b3a1-c614bc367d9c",
    "createdAt": "2016-07-27T13:57:43.361554Z",
    "href": "https://localhost:3000/api/v1/topologies/525a2d06-bfa4-4ad5-b3a1-c614bc367d9c",
    "gateways": [
      "608509"
    ],
    "links": [
      {
        "start": "608509",
        "end": "5ecad4",
        "linkQuality": 71
      },
      {
        "start": "5ecad4",
        "end": "608509",
        "linkQuality": 68
      }
    ]
  }
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "id": {
          "description": "Unique identifier for this topology resource",
          "type": "string"
        },
        "createdAt": {
          "description": "Topology creation date (ISO8601 format)",
          "type": "string"
        },
        "href": {
          "description": "URI for this topology resource",
          "type": "string"
        },
        "gateways": {
          "items": {
            "description": "Gateway MAC address",
            "type": "string"
          },
          "type": "array"
        },
        "links": {
          "items": {
            "type": "object",
            "properties": {
              "start": {
                "description": "Start address for this link",
                "type": "string"
              },
              "end": {
                "description": "End address for this link",
                "type": "string"
              },
              "linkQuality": {
                "description": "Link quality for this link (-dBm)",
                "type": "integer"
              }
            }
          },
          "type": "array"
        }
      }
    }
  }
}
Response  404
HideShow

No device found for this identifier.

Body
{
  "error": {
    "message": "Topology could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Delete topology
DELETE/api/v1/topologies/{topologyId}

Delete the stored information about this previously generated topology.

Example URI

DELETE /api/v1/topologies/525a2d06-bfa4-4ad5-b3a1-c614bc367d9c
URI Parameters
HideShow
topologyId
string (required) Example: 525a2d06-bfa4-4ad5-b3a1-c614bc367d9c

Unique identifier for a topology, or latest to refer to the topology with the most recent createdAt timestamp.

Response  204
HideShow

Successfully deleted topology.

Response  404
HideShow

No device found for this identifier.

Body
{
  "error": {
    "message": "Topology could not be found"
  }
}
Schema
{
  "type": "object",
  "properties": {
    "error": {
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    }
  }
}

Topology Generation State

Handles requests for topology generation currently in progress or not.

Get topology generation state
GET/api/v1/topologyInProgress

Example URI

GET /api/v1/topologyInProgress
Response  200
HideShow

Successfully retrieved topology progress

Body
{
  "data": true
}
Schema
{
  "type": "object",
  "properties": {
    "data": {
      "description": "Indicates whether topology generation is in progress",
      "type": "boolean"
    }
  }
}

Generated by aglio on 26 Jan 2017