Step 4: Submit a request and review a response

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

Authorization

Yes

String

The authorization token returned from the Log In endpoint.
Enter: Token <place token returned from Login endpoint here>.

Content-Type

Yes

String

The media type of the body sent to the API.
Enter: application/json.

Accept

Yes

String

The media type of response the client can accept from the server.
Enter: application/json.


Request Body

The following table describes each parameter in the request body.

ParameterRequiredData typeDescription
realm_listYesArray of int32sA list of the realm_ids to get the attributes for. Realms and their values are listed in Appendix A: Realms.
user_idNoInt32The 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_idNoInt32The 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

message

String

A message saying the call was successful or not.

attrib_list

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).

display_name

String

A display name for the attribute.

name

String

An internal name for the attribute.

default_text

String

Default value for the attribute. This parameter is sent for type "text", "password", "date", "time", "date_time", and "image".

max_length

Integer

The maximum number of characters that can be entered. This parameter is sent only for the "text" or "password" type.

attrib_id

Integer

The unique identifier for the attribute to be used in subsequent calls.

realm

Integer

The realm this attribute is for in the context of the request.

type

String

The type of attribute.

order

Integer

The order in which this attribute should be displayed.

type_flags

Dictionary

A set of indicators that specify various aspects of attribute handling.

required

Boolean

An indication of whether the attribute must be filled in/provided by user or not.

display

Boolean

An indication of whether the attribute should show on the front-end or be hidden.

read_only

Boolean

An indication of whether this attribute is for display only purposes or is allowed to be changed/set.

type

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):
- 0 – All types
- 1 – Scheduled
- 2 – Now/On-Demand

success

Boolean

An indication of whether the call is successful or not.


Error Codes

Error codeDescription
- 103An invalid realm parameter was passed or a parameter is missing