Before you can call any other endpoints, let’s make a call to retrieve a list of attributes. This call provides essential information about the specific realm's configuration, enabling you to understand its structure and proceed with making further API requests.
Request
POST http://prod1.serveture.com/public-api/list_attributes
Request Headers
The following table describes each parameter that must be included in the request header.
Parameter | Required | Data type | Description |
---|---|---|---|
| Yes | String | The authorization token returned from the Log In endpoint. |
| Yes | String | The media type of the body sent to the API. |
| Yes | String | The media type of response the client can accept from the server. |
Request Body
The following table describes each parameter in the request body.
Parameter | Required | Data type | Description |
---|---|---|---|
realm_list | Yes | Array of int32s | A list of the realm_ids to get the attributes for. Realms and their values are listed in Appendix A: Realms. |
user_id | No | Int32 | The internal identifier for the user for which the realm attributes should be retrieved for. If not provided, the request will be based on the caller's user ID. |
enterprise_id | No | Int32 | The identifier for the enterprise for which the realm attributes should be retrieved for. If not provided, the request will be based on the user's enterprise ID (if it exists). Note: This value will be ignored for any users who are already directly associated with an enterprise. |
Example Request
The following request retrieves a list of attributes for the Worker Registration realm.
{
"method": "POST",
"url": "http://prod1.serveture.com/public-api/user_login/",
"headers": {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Token <place token returned from Login endpoint here>"
},
"body": {
"realm_list": [
1
],
"user_id": 0,
"enterprise_id": 0
}
}
Example Response
The following response provides an example of a list of attributes for the Worker Registration realm. It contains attributes of the text and password types.
{
"message": "Success!",
"attrib_list": [
{
"display_name": "First Name",
"name": "first_name",
"default_text": "",
"max_length": 50,
"attrib_id": 14,
"realm": 1,
"type": "text",
"order": 6,
"type_flags": {
"read_only": false,
"required": true,
"type": 0,
"display": true
}
},
{
"display_name": "Password",
"name": "password",
"default_text": "",
"max_length": 50,
"attrib_id": 13,
"realm": 1,
"type": "password",
"order": 3,
"type_flags": {
"read_only": false,
"required": true,
"type": 0,
"display": true
}
}
],
"success": true
}
Response Definitions
Response item | Type | Description | ||
---|---|---|---|---|
| String | A message saying the call was successful or not. | ||
| Array of objects | A list of all request attributes that must be shown to the end user to be filled in (some may be optional and some may have defaults). | ||
| String | A display name for the attribute. | ||
| String | An internal name for the attribute. | ||
| String | Default value for the attribute. This parameter is sent for type "text", "password", "date", "time", "date_time", and "image". | ||
| Integer | The maximum number of characters that can be entered. This parameter is sent only for the "text" or "password" type. | ||
| Integer | The unique identifier for the attribute to be used in subsequent calls. | ||
| Integer | The realm this attribute is for in the context of the request. | ||
| String | The type of attribute. | ||
| Integer | The order in which this attribute should be displayed. | ||
| Dictionary | A set of indicators that specify various aspects of attribute handling. | ||
| Boolean | An indication of whether the attribute must be filled in/provided by user or not. | ||
| Boolean | An indication of whether the attribute should show on the front-end or be hidden. | ||
| Boolean | An indication of whether this attribute is for display only purposes or is allowed to be changed/set. | ||
| Integer | An indication of which type of request these flags are for. Current valid values are (these values are only applicable for Service Request based attributes): | ||
| Boolean | An indication of whether the call is successful or not. |
Error Codes
Error code | Description |
---|---|
- 103 | An invalid realm parameter was passed or a parameter is missing |