The department services are used for operations to get a list of departments for the company and to update the default department for a user.
a) All Departments
Get a list of the currently logged-in user’s departments.
Request (JSON)
GET /Departments/?securitytoken={sessionToken} Content-Type:application/json
Response (JSON)
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 [{"DepartmentId":"223a4516-41d5-4327-97ca-65c67d6b20a0", "IsDefault":false,"Name":"Afdeling 1"}, ... {"DepartmentId":"c4dcc6f2-ff52-4a22-b29d-aae817b5c8e7", "IsDefault":false,"Name":"Slik"}]
b) Set Default Department
In our iPhone app, you change the department that you are currently looking at by setting the default department.
Request (JSON)
PUT /departments/c4dcc6f2-ff52-4a22-b29d-aae817b5c8e7/?SecurityToken={sessionToken} Content-Type: application/json {"DepartmentId":"c4dcc6f2-ff52-4a22-b29d-aae817b5c8e7","IsDefault":true}
Response (JSON)
HTTP/1.1 200 OK