Choices Generic Action

Format:

GET http://<server_address>/api/<resource_type>/<resource_name>/choices/
 ?hierarchy=[hierarchy]
 &format=json

Action

choices

Description

Get a list of resource instances at a hierarchy as value-title pairs. Requires a business key in the resource model definition.

Method

GET

URL

/api/<resource_type>/<resource_name>/choices/ or without resource specification: /api/choices/

Parameters

hierarchy=[hierarchy], format=json, pagination parameters (see API Parameters), filter parameters (see Filter Parameters for Choices).

Response

A JSON payload with:

  • pagination details

  • meta information: query, list of instance references with pkid and href of data

  • choices data: list of value-title pairs of the business keys. On the GUI choices list, the response title displays, while the value is returned. Filter parameters can modify this standard behavior - see Filter Parameters for Choices.

support_async

false

Example:

  • Request

    GET http://<server_address>/api/data/Countries/choices/
     ?hierarchy=[hierarchy]
     &format=json
    
  • Response

    HTTP 200 OK
    Vary: Accept
    X-Request-ID: 9bcd77b4cd27dccd0f18a1d8d22e7ddab85aa848
    Content-Type: text/html; charset=utf-8
    Allow: GET, HEAD, OPTIONS
    Response-Content:
    {
    
        pagination : {
            direction :  asc,
            maximum_limit :  2000,
            skip :  0,
            limit :  0,
            total_limit : null,
            total :  37
        },
        meta : {
            query :  /api/data/Countries/choices/,
            references : [
               {
                   pkid :  5a16c3c68963f91b84baf357,
                   href :  /api/data/Countries/5a16c3c68963f91b84baf357/
               },
               ...
            ]
        },
        choices : [
            {
                value :  ["Australia", "AUS", "hcs"],
                title :  ["Australia", "AUS", "hcs"]
            },
            ...