Types

The controller keeps track of all known types in the types library and enables enumerating, filtering, and finding all types of information stored there. The types library is available at the /aps/2/types collection of the APS controller.

Getting a List of Types

The following is a request for the full list of all types:

GET /aps/2/types

The response with code HTTP/1.1 200 OK returns a list of all known types, for example:

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Range: items 0-99/100

[
   {
      "aps": {
         "id": "117",
         "href": "https://apsc.aps-standard.org/types/117"
      },
      "apsVersion": "2.0",
      "name": "vps",
      "id": "http://aps-standard.org/samples/basic1pn/vps/1.0",
      "implements": [
         "http://aps-standard.org/types/core/resource/1.0"
      ],
      ...
   },
   {
      "aps": {
         "id": "116",
         "href": "https://apsc.aps-standard.org/types/116"
      },
      "apsVersion": "2.0",
      "name": "context",
      "id": "http://aps-standard.org/samples/basic1pn/context/1.0",
      "implements": [
         "http://aps-standard.org/types/core/resource/1.0"
      ],
      ...
   },
   ...
]

The standard Pagination rules are applied to the output.

Note

The output contains two IDs:

  • aps.id in the aps section is a string with the APS ID of the type

  • id is the type ID in the URL format used in implementation (inheritance) and relations (links)

Getting Type Details

The APS controller returns a resource schema, if it receives a GET request on the types collection with the APS ID of the type as a suffix:

GET /aps/2/types/{aps.id}

Sample request:

GET /aps/2/types/117

Sample response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8

{
   "aps": {
      "id": "117",
      "href": "https://apsc.aps-standard.org/types/117"
   },
   "apsVersion": "2.0",
   "name": "vps",
   "id": "http://aps-standard.org/samples/basic1pn/vps/1.0",
   "implements": [
      "http://aps-standard.org/types/core/resource/1.0"
   ],
   "properties": {
      "name": {
         "type": "string",
         "title": "name",
         "description": "Server Name"
      },
   ...
   "operations": {
         ...
   },
   "structures": {
         ...
   },
   "relations": {
         ...
   }
 }

Filtering by Type ID

To find a type by its type ID, use the id={ID} filter, as in the following example.

Sample request:

GET /aps/2/types?id=http://aps-standard.org/samples/basic1pn/vps/1.0

Sample response:

[
   {
      "aps": {
         "id": "117",
         "href": "https://apsc.aps-standard.org/types/117"
      },
      "apsVersion": "2.0",
      "name": "vps",
      "id": "http://aps-standard.org/samples/basic1pn/vps/1.0",
      "implements": [
         "http://aps-standard.org/types/core/resource/1.0"
      ],
      "properties": {
         "name": {
            "type": "string",
            "title": "name",
            "description": "Server Name"
         },
         ...
      },
      ...
   }
]

It is possible to pass the base part of a type ID Basename or a fully-qualified Basename + Version. In the first case, all known versions of the type will be returned. If a filter contains only a major part of the version, all matching minor versions will be returned.

Getting Composing Types

To get a list of types composing the specified type {type-id}, the composing({type-id}) suffix must be added to the types collection. The APS controller returns a list of the types that the specified type implements. The list also contains the type itself.

The following example confirms that the core application type implements the core resource type.

Sample request:

GET /aps/2/types?composing(http://aps-standard.org/types/core/application/1.0)
Content-Type: application/json

Sample response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Range: items 0-1/2

[
   {
     "aps": {
         "id": "1",
         "href": "https://apsc.aps-standard.org/types/1"
      },
      "apsVersion": "2.0",
      "id": "http://aps-standard.org/types/core/resource/1.0",
      "name": "Resource",
       ...
   },
   {
     "aps": {
         "id": "6",
         "href": "https://apsc.aps-standard.org/types/6"
      },
      "apsVersion": "2.0",
      "name": "Application",
      "id": "http://aps-standard.org/types/core/application/1.0",
      "implements": [
         "http://aps-standard.org/types/core/resource/1.0"
      ],
      ...
   }
]

Getting Derivative Types

To get a list of types derived from the specified type {type-id}, the implementing({type-id}) suffix must be added to the type collection. The APS controller returns a list of the types that implement the specified type. The list also contains the type itself.

Sample request:

GET /aps/2/types?implementing(http://aps-standard.org/types/mail/recipient/1.0)
Content-Type: application/json

Sample response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Range: items 0-8/9

[
   {
      "aps": {
         "id": "62",
         "href": "https://apsc.aps-standard.org/types/62"
      },
      "apsVersion": "2.0",
      "name": "MailContact",
      "id": "http://parallels.com/aps/types/pa/mail/contact/1.0",
      "implements": [ "http://aps-standard.org/types/mail/contact/1.0" ],
      ...
   },
   {
     "aps": {
         "id": "63",
         "href": "https://apsc.aps-standard.org/types/63"
      },
      "apsVersion": "2.0",
      "name": "MailList",
      "id": "http://parallels.com/aps/types/pa/mail/list/1.0",
      "implements": [ "http://aps-standard.org/types/mail/list/1.0" ],
      ...
   },
   {
     "aps": {
         "id": "40",
         "href": "https://apsc.aps-standard.org/types/40"
      },
      "apsVersion": "2.0",
      "name": "MailRecipient",
      "id": "http://aps-standard.org/types/mail/recipient/1.0",
       ...
   },
   ...
]