Get resource types

get

/rest/ofscMetadata/v1/resourceTypes

This operation retrieves a collection of resource types.

Configuration: You must grant permissions to the Core API and must at least set Read-Only access to the Resource type entity in the Configuration, Applications (API permissions) screen.

Request

Query Parameters
  • The translation language code. Based on the value of this parameter, the translation for the name of the resource type is returned in the 'name' field.
    • If the value is specified, then the translated value is returned in the 'name' field and the 'translations' field is not returned in the response.
    • If translation for the specified language does not exist, then the value in the 'name' field is returned in English.
    • If the value is not specified, then the 'translations' field is returned in the response and contains the translations to every language in the system.

    For the list of supported language codes, see Supported Language Codes.

  • The number of resource type records to be returned in the response. The minimum value that can be specified is 1 and the maximum value that can be specified is 100. If the specified value is greater than 100, zero, or if no value is specified, then it defaults to 100.
  • The record number from which the retrieval starts. The default value is zero. If no value is specified, then it defaults to zero. The value zero indicates that the retrieval will start from the beginning of the collection.
Back to Top

Response

Supported Media Types

200 Response

This section describes the 200 status response for this operation.
Body ()
Root Schema : ResourceTypes
Type: object
The array of resource type records in the collection.
Show Source
Nested Schema : items
Type: array
Show Source
Nested Schema : Resource Type
Type: object
Title: Resource Type
Show Source
  • Title: Active
    Contains one of the following values: true or false.

    If true, then the resource type is listed as a possible value in the 'Resource Type' drop-down list in Manage or Mobility apps while creating a resource. If false, then the resource type is not listed as a value in the drop-down list. The default value is true.

  • Title: Label
    The unique label assigned to the resource type. For example, GR (Group).
  • Title: Name
    Minimum Length: 1
    Maximum Length: 40
    The translation for the name of the resource type.

    If the language parameter is specified, then the name is provided in that language.

    If the language parameter is not specified, then the name is provided in English, unless the request is performed using an OFSC user account which is linked to an API application (in this case, the name is provided in the language of the user making the request).

  • Title: Role
    The role of the resource type.
  • Translations
    Title: Translations
    The list of translations associated with the name of the resource type. The list is only returned if the language parameter is not specified in request.
Nested Schema : Translations
Type: array
Title: Translations
The list of translations associated with the name of the resource type. The list is only returned if the language parameter is not specified in request.
Show Source
Nested Schema : Translation
Type: object
Show Source
  • This field contains language code of a text translation, it conatains two characters length code in responses (e.g. 'en', 'es') but can be used in requests as extended ISO code (e.g. 'en-US') as well as old two character format.
  • This field is used only in responses and returns ISO language code (e.g. 'en-US'). This field is ignored in the requests (use 'language' instead)

Default Response

This section describes the default error response for this operation.
Body ()
Root Schema : Error
Type: object
Error response
Show Source
Back to Top

Examples

Example 1

The following example shows how to obtain a collection of resource types by submitting a GET request on the REST resource using cURL.

Use the cURL command with the following syntax:

curl -u '<CLIENT-ID>@<INSTANCE-NAME>:<CLIENT-SECRET>' \
     -H 'Accept: application/json' \
     'https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/resourceTypes/?limit=2&offset=2'

Response Header Example

The following shows an example of the response header:

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 24 Jan 2018 12:28:18 GMT
Content-Type: application/json; charset=utf-8
Connection: close

Response Body Example

The following shows an example of the response body in JSON format:

{
    "hasMore": true,
    "totalResults": 10,
    "limit": 2,
    "offset": 2,
    "items": [
        {
            "label": "BK",
            "name": "Bucket",
            "active": true,
            "role": "bucket",
            "translations": [
                {
                    "language":"en",
                    "name": "Bucket",
                    "languageISO": "en-US"
                },
                {
                    "language":"es",
                    "name": "Envase",
                    "languageISO": "es-ES"
                }
            ],
            "links": [
                {
                    "rel": "describedby",
                    "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/metadata-catalog/resourceTypes"
                }
            ]
        },
        {
            "label": "TR",
            "name": "Truck",
            "active": true,
            "role": "vehicle",
            "translations": [
                {
                    "language":"en",
                    "name": "Truck",
                    "languageISO": "en-US"
                },
                {
                    "language":"es",
                    "name": "Cami??n",
                    "languageISO": "es-ES"
                }
            ],
            "links": [
                {
                    "rel": "describedby",
                    "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/metadata-catalog/resourceTypes"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "canonical",
            "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/resourceTypes/?limit=2&offset=2"
        },
        {
            "rel": "prev",
            "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/resourceTypes/?limit=2&offset=0"
        },
        {
            "rel": "next",
            "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/resourceTypes/?limit=2&offset=4"
        },
        {
            "rel": "describedby",
            "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/metadata-catalog/resourceTypes"
        }
    ]
}

Example 2

The following example shows how to obtain a collection of resource types by using the language parameter with the GET request on the REST resource.

Use the cURL command with the following syntax:

curl -u '<CLIENT-ID>@<INSTANCE-NAME>:<CLIENT-SECRET>' \
     -H 'Accept: application/json' \
     'https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/resourceTypes/?language=en-US&limit=2&offset=2'

Response Header Example

The following shows an example of the response header.

HTTP/1.1 200 OK
Server: nginx
Date: Wed, 24 Jan 2018 12:28:18 GMT
Content-Type: application/json; charset=utf-8
Connection: close

Response Body Example

The following shows an example of the response body in JSON format:

{
    "hasMore": true,
    "totalResults": 10,
    "limit": 2,
    "offset": 2,
    "items": [
        {
            "label": "BK",
            "name": "Bucket",
            "active": true,
            "role": "bucket",
            "links": [
                {
                    "rel": "describedby",
                    "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/metadata-catalog/resourceTypes"
                }
            ]
        },
        {
            "label": "TR",
            "name": "Truck",
            "active": true,
            "role": "vehicle",
            "links": [
                {
                    "rel": "describedby",
                    "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/metadata-catalog/resourceTypes"
                }
            ]
        }
    ],
    "links": [
        {
            "rel": "canonical",
            "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/resourceTypes/?language=en-US&limit=2&offset=2"
        },
        {
            "rel": "prev",
            "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/resourceTypes/?language=en-US&limit=2&offset=0"
        },
        {
            "rel": "next",
            "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/resourceTypes/?language=en-US&limit=2&offset=4"
        },
        {
            "rel": "describedby",
            "href": "https://<instance_name>.etadirect.com/rest/ofscMetadata/v1/metadata-catalog/resourceTypes"
        }
    ]
}
Back to Top