User Preferences contain a set of settings associated with a specific User. These settings are set exclusively per User and are either set in the web portal by an admin personnel or set in the application according to the User’s choice. These User Preferences often contain Driver information and controls the options that will or will not be available for the User in the application.
Fields
Tag | Data Type | Required | Description |
accountId | Long | Auto | The id of the Account that owns this record. |
displayName | Text (unlimited) | No | The display name of the User Preference. |
id | Auto-incremented Long | Auto | Unique Identifier |
isEditable | Boolean | No | Indicates if the User Preference is editable or not. |
key | Character (255) | No | String identifier for the User Preference. Predefined User Preferences can either be one of the following:
|
lastChangedDate | Text | Auto | Auto-generated timestamp of the last change made to this record Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z) |
prefType | Character (255) | No | Indicates the type of value the User Preference can be set to. Either: BOOL_PREF / STRING_PREF |
stringVal | Text (unlimited) | No | Indicates the value of the User Preference. |
userId | Long | Yes | The id of the User that owns this Preference. |
Read
API PATH: | /api/v2/userPreferences |
METHOD: | GET |
PARAMETERS: | user-id – Retrieves matching records for specific User from-change-timestamp – Retrieves matching records that were changed after the specified timestamp (e.g. from-change-timestamp=2018-06-11T12:00:00.000Z, all timestamps by default) to-change-timestamp – Retrieves matching records that were changed before the specified timestamp (e.g. to-change-timestamp=2018-06-11T12:00:00.000Z, REQUIRES from-change-timestamp) offset – Retrieves matching records after an offset value (e.g. offset=2, zero offset by default) limit – Retrieves a number of records per page specified by the value (e.g. limit=10, all records by default) |
SORTING: | sort=id – Sort records by their id field in ascending order (DEFAULT) sort=-id – Sort records by their id field in descending order sort=key – Sort records by their id field in ascending order sort=-key – Sort records by their id field in descending order |
QUERY STRING EXAMPLES: | Get the User Preference with the specified id: api/v2/userPreferences/113880 Get two User Preferences of the current Account with an offset of 1 : ?offset=1&limit=2 Get all User Preferences of the current Account sorted by key alphabetically: ?sort=key |
EXAMPLE RESPONSE: |
[ { "userId": 1252076, "key": "SHOW_WORKORDER", "prefType": "BOOL_PREF", "stringVal": "true", "displayName": "Show Work Orders", "isEditable": true, "accountId": 1248401, "id": 113880, "lastChangedDate": "2018-06-11T12:00:00.000Z" } ] |
Create
API PATH: | /api/v2/userPreferences |
METHOD: | POST |
EXAMPLE REQUEST: |
[ { "userId": 1252076, "key": "NEW_PREF1", "prefType": "BOOL_PREF", "stringVal": "true", "displayName": "Custom Pref1", "isEditable": true } ] |
EXAMPLE RESPONSE: |
[ { "userId": 1252076, "key": "NEW_PREF1", "prefType": "BOOL_PREF", "stringVal": "true", "displayName": "Custom Pref1", "isEditable": true, "accountId": 1248401, "id": 119445, "lastChangedDate": "2018-06-11T12:00:00.000Z" } ] |
Update
API PATH: | /api/v2/userPreferences |
METHOD: | PUT |
EXAMPLE REQUEST: |
[ { "userId": 1252076, "key": "NEW_PREF1", "prefType": "BOOL_PREF", "stringVal": "false", "displayName": "Custom Pref1", "isEditable": true, "id": 119445 } ] |
EXAMPLE RESPONSE: |
[ { "userId": 1252076, "key": "NEW_PREF1", "prefType": "BOOL_PREF", "stringVal": "false", "displayName": "Custom Pref1", "isEditable": true, "accountId": 1248401, "id": 119445, "lastChangedDate": "2018-06-11T12:00:00.000Z" } ] |
Delete
API PATH: | /api/v2/userPreferences/<id> |
METHOD: | DELETE |
API error calls
ERROR MESSAGE | POSSIBLE CAUSES |
Entities should contain a Key when creating. | POST and PUT methods requires the Key field |