Table Of Contents

Packages

The APS controller keeps track of all imported APS packages. You can both list and find packages, and access any file in a package. The package library is available through the /aps/2/packages collection on the APS controller.

Getting Package List

To get a list of packages imported to the APS controller, the GET request must be sent to the package collection as in the following example:

GET /aps/2/packages
Content-Type: application/json

Sample response:

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

[
     {
        "aps": {
           "id": "b096f82a-a83f-44f5-8599-1e61173e9f72",
           "href": "/aps/2/packages/b096f82a-a83f-44f5-8599-1e61173e9f72"
        },
        "apsVersion": "2.0",
        "id": "http://aps-standard.org/samples/suwizard1p",
        "name": "User Management Demo",
        "version": "1.0",
        "release": "0",
        "services": {
           "clouds": {...},
           "contexts": {...},
           "vpses": {...},
           "offers": {...}
        }
     },
        ...
]

Getting all package details in the list of packages is often unnecessary. The list of package IDs is generally enough, as it allows the application or the system to request extra details from certain packages. This saves time and increases overall performance. The following Resource Query Language (RQL) functions help you achieve this goal.

  • The select(aps.id) function allows you to request only package APS IDs.

    Note

    In case of packages, no other input arguments except for aps.id are accepted as the latter is the only mandatory property in all packages.

  • The active() RQL function applicable to the packages collection selects only active packages.

For example, the following is a request for APS IDs of all active packages:

GET /aps/2/packages?active(),select(aps.id)

Getting Package Details

It is possible to get package {package-id} data by sending a GET request to /aps/2/packages/{package-id} using one of content types, either application/json (default) or application/aps. The required content type is specified in the Accept header.

When using the default Accept: application/json header, the APS controller returns the JSON representation of the requested package.

Sample request:

GET /aps/2/packages/d3ad0a6b-69f1-476f-8aba-cfa72c385978
Accept: application/json

Sample response:

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

{
   "aps":
   {
      "id": "d3ad0a6b-69f1-476f-8aba-cfa72c385978",
      "href": "/aps/2/packages/d3ad0a6b-69f1-476f-8aba-cfa72c385978"
   },
   "apsVersion": "2.0",
   "id": "http://event-mgmt.demo.apsdemo.org/vpsclouds",
   "name": "VPS Cloud Event Processing",
   "version": "1.0",
   "release": "1",
   "services":
   {
      "clouds":
      {
         "type": "http://event-mgmt.demo.apsdemo.org/vpsclouds/clouds/1.0",
         "schema": "/aps/2/packages/d3ad0a6b-69f1-476f-8aba-cfa72c385978/schemas/clouds.schema.gen",
         "name": "clouds",
         "summary": "VPS cloud application global service"
      },
      "offers":
      {
         "type": "http://event-mgmt.demo.apsdemo.org/vpsclouds/offers/1.0",
         "schema": "/aps/2/packages/d3ad0a6b-69f1-476f-8aba-cfa72c385978/schemas/offers.schema.gen",
         "name": "offers",
         "summary": "Set of VPS parameters"
      },
      "contexts":
      {
         "type": "http://event-mgmt.demo.apsdemo.org/vpsclouds/contexts/1.0",
         "schema": "/aps/2/packages/d3ad0a6b-69f1-476f-8aba-cfa72c385978/schemas/contexts.schema.gen",
         "name": "contexts",
         "summary": "VPS management environment"
      },
      "vpses":
      {
         "type": "http://event-mgmt.demo.apsdemo.org/vpsclouds/vpses/1.0",
         "schema": "/aps/2/packages/d3ad0a6b-69f1-476f-8aba-cfa72c385978/schemas/vpses.schema.gen",
         "name": "vpses",
         "summary": "Cloud virtual private server"
      },
      "events":
      {
         "type": "http://event-mgmt.demo.apsdemo.org/vpsclouds/events/1.0",
         "schema": "/aps/2/packages/d3ad0a6b-69f1-476f-8aba-cfa72c385978/schemas/events.schema.gen",
         "name": "events",
         "summary": "Processing event notifications"
      }
   }
}

When using the Accept: application/aps header, the APS controller returns the zipped APS package.

Sample request:

GET /aps/2/packages/d3ad0a6b-69f1-476f-8aba-cfa72c385978
Accept: application/aps

Sample response:

HTTP/1.1 200 OK
Content-Length: 350401
Content-Type: application/aps
Content-Disposition: attachment; filename="VPS Cloud Event Processing-1.0-1.aps"

... /* binary data */ ...

Getting Package Metadata

If the APS controller receives a GET request addressed to /aps/2/packages/{id}/APP-META.xml, it returns the APP-META.xml file contents.

Sample request:

GET /aps/2/packages/6e3c3164-d36e-4c63-9b43-d758c1a0acb6/APP-META.xml
Accept: application/xml

Sample response:

HTTP/1.1 200 OK
Content-Type: application/xml

<application xmlns="http://aps-standard.org/ns/2" packaged="2012-11-15T13:11:37" version="2.0">
    <id>http://wordpress.org/2.0</id>
    <name>WordPress</name>
    <version>3.4.2</version>
    <release>2.0.6</release>
    <homepage>http://wordpress.org/</homepage>
    ...
</application>

Getting a File from a Package

You can get the contents of any file from a package by the package ID using a request similar to the following:

Sample request:

GET /aps/2/packages/b096f82a-a83f-44f5-8599-1e61173e9f72/schemas/vpses.schema.gen
Accept: application/json

Sample response:

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

// This file is generated by 'aps build' from 'scripts/vpses.php' script
// It will be regenerated next time 'aps build' command is executed
{
    "apsVersion": "2.0",
    "name": "vps",
    "id": "http://aps-standard.org/samples/suwizard1p/vps/1.0",
    "implements": [
        "http://aps-standard.org/types/core/user/service/1.0"
    ],
     ...
 }
Types
Protocols