Device API
- Former user (Deleted)
- Former user (Deleted)
Table of Contents
Register Device
Current Implementation
A device is registered to a user depending on the type of usage the user decided at login time: Normal usage or Guest usage. In the case of Normal usage, the device-user relation is always registered in the server.
Parameters
Base URL: /registerDevice
Parameters:
Name | Type | Mandatory | Description |
---|---|---|---|
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
deviceId | String | Yes | The id of the device where we want userId to be registered. |
shiftLength | Int | No | The duration of the user's shift in hours. If this parameter is present, a timer will be set to automatically log out the user. |
API Sample
curl 'http://192.168.2.102:8080/PresentationServices/registerDevice?deviceId=596a1d880a22eb32&userId=poda&token=d2360c39-637b-41da-988d-f031db5affbb&_=1395133673256' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'User-Agent: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36' --compressed
{ "statusFact":{ "success":true } }
Fetch Devices
This operation is used to fetch all available Devices with associated Assignments for a given organization or facility or workspace.
Parameters
Base URL: /getDevices
Request Type: GET
Name | Type | Mandatory | Description |
---|---|---|---|
location | String | No | The location to fetch devices. Location can be "ORGANIZATION" or "FACILITY" or "WORKSPACE" |
token | String | Yes | Security Token obtained before. |
userId | String | Yes | The id of the logged in user. |
locationId | String | No | The id of the Organization or Facility or Workspace based on above location parameter value. |
status | String | No | The status of device. |
API Sample
Happy Scenario
{"data":[{"model":"Nexus 7","facilityName":"Facility A.1","organizationName":"Organization A","status":"ACTIVE","imei":"Cognitive-109","serialNumber":"015d2a508c0c0a0e","macAddress":"50:46:5d:1e:f6:4f","organizationId":"QA_Organization_A","facilityId":"QA_Facility_A_1","workspaceId":"QA_Facility_A_1_Workspace1","assignment":"poda","stockNumber":6,"workspaceName":"Workspace 1"},{"model":"Nexus 5","facilityName":"Facility A.1","organizationName":"Organization A","status":"ACTIVE","imei":"Cognitive-110","serialNumber":"04a4edd425230a15","macAddress":"cc:fa:00:ab:1e:cddd","organizationId":"QA_Organization_A","facilityId":"QA_Facility_A_1","workspaceId":"QA_Facility_A_1_Workspace1","assignment":"poda","stockNumber":7,"workspaceName":"Workspace 1"},{"model":"Nexus 7","facilityName":"Facility A.1","organizationName":"Organization A","status":"ACTIVE","imei":"Cognitive-105","serialNumber":"015d2a508c0c0a0e","macAddress":"50:46:5d:1e:f6:3f-hhhhj","organizationId":"QA_Organization_A","facilityId":"QA_Facility_A_1","workspaceId":"QA_Facility_A_1_Workspace1","assignment":"poda","stockNumber":20,"workspaceName":"Workspace 1"},{"model":"Nexus 5","facilityName":"Facility A.2","organizationName":"Organization A","status":"ACTIVE","imei":"Cognitive-107","serialNumber":"04a4edd425230a16","macAddress":"cc:fa:00:ab:1e:bcge","organizationId":"QA_Organization_A","facilityId":"QA_Facility_A_2","workspaceId":"QA_Facility_A_2_Workspace1","assignment":"poda","stockNumber":3,"workspaceName":"Workspace 1"},{"model":"Nexus 5","facilityName":"Facility A.3","organizationName":"Organization A","status":"ACTIVE","imei":"Cognitive-112","serialNumber":"04a4edd425230a17","macAddress":"cc:fa:00:ab:1e:yd","organizationId":"QA_Organization_A","facilityId":"QA_Facility_A_3","workspaceId":"QA_Facility_A_3_Workspace1","assignment":"podg","stockNumber":9,"workspaceName":"Workspace 1"}],"statusFact":{"success":true}}
Not enough Permissions
In the case userId doesn't have 'list_devices' permission, the operation returns a 403 (Forbidden) error with the body "Not enough permissions.".
In the case userId doesn't have 'list_devices_from_all_organizations' permission if location is not specified, the operation returns a 403 (Forbidden) error with the body "Not enough permissions.".
Delete Device
This operation is used to delete devices and associated assignments from the database for a particular device id.
This Delete supports only soft delete that is just updates status to In-Active in Devices table.
Parameters
Base URL: /deleteDevice
Request Type: POST
Name | Type | Mandatory | Description |
---|---|---|---|
userId | String | Yes | The id of the logged in user. |
deviceId | String | Yes | The id of the device. |
token | String | Yes | Security Token obtained before. |
Note : 1) ALL the parameters of the specified template must be present in the request.
API Sample
Happy Scenario
http://localhost:8080/PresentationServices/deleteDevice?token=a578dbf4-1800-4a82-be24-b212ba43b278&userId=A_pod1
{"statusFact":{"success":true}}
Not enough Permissions
In the case userId doesn't have 'delete_devices' permission, the operation returns a 403 (Forbidden) error with the body "Not enough permissions.".
Create or Update Device
This operation is used to add or update devices and associated device assignments.
Parameters
Base URL: /organizations/workspaces/{workspace}/CreateOrUpdateDevices
Request Type: POST
Name | Type | Mandatory | Description |
---|---|---|---|
roomId | String | No | The room id to create |
userId | String | Yes | The id of the logged in user. |
token | String | Yes | Security Token obtained before. |
workspace | String | Yes | The id of the workspace. |
deviceId | String | Yes | The id of the device. |
macAddress | String | Yes | The mac address of device. |
model | String | Yes | The model of device. |
serialNum | String | Yes | The serial number of device. |
status | String | Yes | The status of device. |
stockNumber | String | No | The stock number of device required for update. |
API Sample
Happy Scenario
http://localhost:8080/PresentationServices/organizations/workspaces/test_nursery/CreateOrUpdateDevices?token=a578dbf4-1800-4a82-be24-b212ba43b278&userId=A_pod1
{"statusFact":{"success":true}}
Not enough Permissions
In the case userId doesn't have 'modify_devices' permission, the operation returns a 403 (Forbidden) error with the body "Not enough permissions.".
Fetch Device History
This operation is used to fetch logged in device history from the database for a particular device id.
Parameters
Base URL: /organizations/{organization}/getDeviceHistory
Request Type: GET
Name | Type | Mandatory | Description |
---|---|---|---|
organization | String | Yes | The id of the organization. |
userId | String | Yes | The id of the logged in user. |
deviceId | String | Yes | The id of the device. |
token | String | Yes | Security Token obtained before. |
Note : 1) ALL the parameters of the specified template must be present in the request.
API Sample
Happy Scenario
http://localhost:8080/PresentationServices/organizations/UNC/getDeviceHistory?token=a578dbf4-1800-4a82-be24-b212ba43b278&userId=A_pod1
{"data":[{"loginTime":"2015-01-12 23:18:28.0","userId":"chargenurse","deviceId":"Cognitive-104"},{"loginTime":"2015-01-13 08:01:07.0","userId":"chargenurse","deviceId":"Cognitive-104"}],"statusFact":{"success":true}}
Not enough Permissions
In the case userId doesn't have 'list_device_history' permission, the operation returns a 403 (Forbidden) error with the body "Not enough permissions.".