Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

Code Block
languagejs
titleResult
collapsetrue
 {

   "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: /organizations/{organization}/workspaces/{workspace}/getDevices

Request Type: GET

 

Name
Type
Mandatory
Description
{organizationId} location StringYesNoThe id of the Organization.location to fetch devices. Location can be "ORGANIZATION" or "FACILITY" or "WORKSPACE"
tokenStringYesSecurity Token obtained before.
userIdStringYesThe id of the logged in user.
{workspaceId} locationId StringYesNoThe id of the Organization or Facility or Workspace based on above location parameter value. 
Note that ALL the parameters of the specified template must be present in the request
statusStringNoThe status of device.

 

Note:
1) getDevices api to fetch devices by Organization or Facility or Workspace. This information can be passed in location parameter and id of the location must present in 'locatoinId' parameter. 
If location is passed as "ORGANIZATION" then locationId should contain organizationId same for "FACILITY" and "WORKSPACE".
2) If location is not exist in request parameter then api retrieves devices for all organizations against user role+list_devices permission.

API Sample

Happy Scenario

http://localhost:8080/PresentationServices/organizations/UNC/workspaces/test_nursery/getDevices?token=a578dbf4d38bad16-1800e48a-4a824580-be24b5b6-b212ba43b278993124ce638c&userId=QA_1&location=ORGANIZATION&locationId=QA_Organization_A_pod1 

 

 

Code Block
languagejs
titleResult
collapsetrue
 
{"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":"ne_nurseryQA_Facility_A_1_Workspace1","assignment":"podg",poda","stockNumber":6,"workspaceName":"Workspace 1"},{"model":"Nexus 5","facilityName":"Facility A.1","statusorganizationName":"ACTIVEOrganization A","stockNumberstatus":4"ACTIVE","imei":"Cognitive-106110","serialNumber":"04a4edd425230a1704a4edd425230a15","macAddress":"cc:fa:00:ab:1e:bdcddd"}],"statusFactorganizationId":{"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.".

 

Fetch Devices By Facility

 

This operation is used to  fetch all available Devices with associated Assignments for a given facility.

Parameters

Base URL: /organizations/{organization}/facility/{facility}/getDevices

Request Type: GET

Name
Type
Mandatory
Description
{organizationId} StringYesThe id of the Organization.
tokenStringYesSecurity Token obtained before.
userIdStringYesThe id of the logged in user.
{facilityId} StringYesThe id of the Facility. 
Note that ALL the parameters of the specified template must be present in the request.

API Sample

Happy Scenario

http://localhost:8080/PresentationServices/organizations/UNC/facility/NorthEastern/getDevices?token=a578dbf4-1800-4a82-be24-b212ba43b278&userId=A_pod1 

 

 

Code Block
languagejs
titleResult
collapsetrue
{"data":[{"workspaceId":"ne_nursery","assignment":"podg",
"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","
status
organizationName":"
ACTIVE
Organization A","
stockNumber
status":
4
"ACTIVE","imei":"Cognitive-
106
107","serialNumber":"
04a4edd425230a17
04a4edd425230a16","macAddress":"cc:fa:00:ab:1e:
bd
bcge"
}]
,"
statusFact
organizationId":
{"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.".

 

Fetch Devices By Organization

 

This operation is used to  fetch all available Devices with associated Assignments for a given organization.

Parameters

Base URL: /organizations/{organization}/getDevices

Request Type: GET

Name
Type
Mandatory
Description
{organizationId} StringYesThe id of the Organization.
tokenStringYesSecurity Token obtained before.
userIdStringYesThe id of the logged in user.
{workspaceId} StringYesThe id of the Workspace. 
Note that ALL the parameters of the specified template must be present in the request.

API Sample

Happy Scenario

http://localhost:8080/PresentationServices/organizations/UNC/getDevices?token=a578dbf4-1800-4a82-be24-b212ba43b278&userId=A_pod1 

 

 

Code Block
languagejs
titleResult
collapsetrue
{"data":[{"workspaceId":"ne_nursery","assignment":"podg",
"QA_Organization_A","facilityId":"QA_Facility_A_2","workspaceId":"QA_Facility_A_2_Workspace1","assignment":"poda","stockNumber":3,"workspaceName":"Workspace 1"},{"model":"Nexus 5","
status
facilityName":"Facility A.3","organizationName":"
ACTIVE
Organization A","
stockNumber
status":
4
"ACTIVE","imei":"Cognitive-
106
112","serialNumber":"04a4edd425230a17","macAddress":"cc:fa:00:ab:1e
:bd
: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: 

/organizations/{organization}

/deleteDevice

Request Type: POST

 

Name
Type
Mandatory
Description
organization
userIdStringYesThe id of the
organization
logged in user.
roomIdStringYesThe room id to create
deviceIdStringYesThe id of the device.
tokenStringYesSecurity 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/Another1

/deleteDevice?token=a578dbf4-1800-4a82-be24-b212ba43b278&userId=A_pod1


 

Code Block
languagejs
titleResult
collapsetrue
 
{"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

/{organization}

/workspaces/{workspace}/CreateOrUpdateDevices

Request Type: POST 

Name
Type
Mandatory
Description
organizationId
 String YesThe id of the Organization.
roomIdStringNoThe room id to create
userIdStringYesThe id of the logged in user.
tokenStringYesSecurity Token obtained before. 
workspaceStringYesThe id of the workspace. 
deviceIdStringYesThe id of the device.
macAddressStringYesThe mac address of device.
modelStringYesThe model of device.
serialNumStringYesThe serial number of device.
statusStringYesThe status of device.
stockNumberStringNoThe stock number of device required for update.

 

API Sample

Happy Scenario

http://localhost:8080/PresentationServices/

/UNC/

workspaces/test_nursery/CreateOrUpdateDevices?token=a578dbf4-1800-4a82-be24-b212ba43b278&userId=A_pod1

 

Code Block
languagejs
titleResult
collapsetrue
 
{"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
organizationStringYesThe id of the organization.
userIdStringYesThe id of the logged in user.
deviceIdStringYesThe id of the device.
tokenStringYesSecurity 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


 

Code Block
languagejs
titleResult
collapsetrue
 {"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.".