#API Document Spec
[toc]
##Update History
| Prepared By | Date | Description |
|---|---|---|
| Susan Hsieh | 2014/12/30 | Get Device list |
| Susan Hsieh | 2014/12/31 | POST Device |
##APIs
List devices that match certain criteria
GET /devices
####Parameters
| Parameter | Value | Description | Type |
|---|---|---|---|
| includeDeleted | false(default) | Include delete | boolean |
| includeSpecification | false(default) | Include specification information | boolean |
| includeAssignment | false(default) | Include assignment if associated | boolean |
| page | 1 | Page Number (First page is 1) | integer |
| pageSize | 100 | Page size | integer |
Parameter content type:query
####Response
{
"results": [
{
"specificationToken": "",
"hardwareId": "",
"parentHardwareId": "",
"deviceElementMappings": [
{
"hardwareId": "",
"deviceElementSchemaPath": ""
}
],
"comments": "",
"assignmentToken": "",
"status": "",
"metadata": "object",
"createdBy": "",
"createdDate": "date-time",
"updatedDate": "date-time",
"updatedBy": "",
"deleted": false
}
],
"numResults": 0
}
####Response Messages
| HTTP Status Code | Reason |
|---|---|
| 200 | OK |
| 403 | Forbidden |
| 401 | Unauthorized |
| 404 | Not Found |
Create a new device
POST /devices
####Parameters
{
"hardwareId": "",
"comments": "",
"specificationToken": "",
"parentHardwareId": "",
"removeParentHardwareId": false,
"deviceElementMappings": [
{
"device": {
"specificationToken": "",
"hardwareId": "",
"parentHardwareId": "",
"deviceElementMappings": [
{
"hardwareId": "",
"deviceElementSchemaPath": ""
}
],
"comments": "",
"assignmentToken": "",
"status": "",
"metadata": "object",
"createdBy": "",
"createdDate": "date-time",
"updatedDate": "date-time",
"updatedBy": "",
"deleted": false
},
"hardwareId": "",
"deviceElementSchemaPath": ""
}
],
"status": "",
"metadata": "object"
}
Parameter content type:applicaion/json
####Response
{
"specificationToken": "",
"hardwareId": "",
"parentHardwareId": "",
"deviceElementMappings": [
{
"hardwareId": "",
"deviceElementSchemaPath": ""
}
],
"comments": "",
"assignmentToken": "",
"status": "",
"metadata": "object",
"createdBy": "",
"createdDate": "date-time",
"updatedDate": "date-time",
"updatedBy": "",
"deleted": false
}
####Response Messages
| HTTP Status Code | Reason |
|---|---|
| 201 | Created |
| 200 | OK |
| 403 | Forbidden |
| 401 | Unauthorized |
| 404 | Not Found |
##Status Codes(Appendix) All status codes are standard HTTP status codes. The below ones are used in this API.
2XX- Success of some kind
4XX- Error occurred in client's part
5XX- Error occurred in server's part
| Status Code | Description |
|---|---|
| 200 | OK |
| 201 | Created |
| 202 | Accepted (Request accepted, and queued for execution) |
| 400 | Bad request |
| 401 | Authentication failure |
| 403 | Forbidden |
| 404 | Resource not found |
| 405 | Method Not Allowed |
| 409 | Conflict |
| 412 | Precondition Failed |
| 413 | Request Entity Too Large |
| 500 | Internal Server Error |
| 501 | Not Implemented |
| 503 | Service Unavailable |