Consuming OpenAir OData Resource Data in Your Applications
Developers can request OpenAir OData resource data and process the response from the OpenAir OData service in their applications.
There are two types of information available from the OData service:
-
The metadata (OData EDMX XML schema v 4.0) describes the collection data types and bears information about the order of fields for each entity (resource or list of resources).
-
The data itself (JSON) provides the raw data as a JSON string.
Applications consuming resources from the OData service should consume the data and the metadata jointly.
The OData service only supports the HTTP GET
method.
GET Request
Send a GET request to the OpenAir OData service method.
-
The GET request URL uses one of the following formats:
-
To access the collection of resources:
https://<account-domain>/odata/v4/<collection>
-
To access the resource collection metadata:
https://<account-domain>/odata/v4/<collection>/$metadata
-
To access the list of resources in the collection:
https://<account-domain>/odata/v4/<collection>/ list
-
To access a resource:
https://<account-domain>/odata/v4/<collection>/<resource>
Where:
-
<account-domain>
is the account-specific domain name for the OpenAir account. For more information about your account-specific domain name, see Your OpenAir Account URLs. -
<collection>
depends on the type of resource you are requesting:reports
orlistviews
. -
<resource>
is the OData resource name of the resource you are requesting.
For more information, see Your OData Feed URL and Connection Details.
-
-
The request must include an Authentication header using the HTTP Basic authentication scheme.
-
Use the following format:
<CompanyID>\<UserID>:<Password>
. -
The string value is Base64 encoded.
-
-
(Optional) Use query options to page through the resource data. The OpenAir OData service supports the query options
$skip
and$top
either in the request body or as query string parameters in the request URL. For more information see OData Query Options.
Example of GET request:
The following examples accesses rows 501 to 750 of the published list view listview12
from the authenticated user’s OpenAir OData feed.
GET /odata/v4/listviews/listview12 HTTP/1.1
Host: honeycomb.app.openair.com
Authorization: Basic ZG9jc191aTRfZGVtb1xtY29sbGluczpUaGlzIGlzYSB2ZXJ5IGxvbmcgcGFzc3dvcmQgeW91IHdvdWxkIG5ldmVyZ3Vlc3M=
Content-Type: application/x-www-form-urlencoded
$top=250&$skip=500
OData Response
If you request a collection, a resource or the list of resources, the OpenAir OData service returns the response as a JSON string with the properties described in the following table.
JSON object properties |
Description |
---|---|
|
The URL for the collection metadata. The metadata is provided in XML format for the entire resource collection using the OData EDMX XML schema v 4.0 ( http://docs.oasis-open.org/odata/ns/edmx). When requesting a specific entity (a resource or the list of resources in the collection), the metadata URL points to that entity. For example:
For each entity, the metadata includes the list of fields — or Properties — listed in the same order as they appear in the report or list view configuration in OpenAir. Each Property as the following attributes:
|
|
An array of objects.
|
|
The number of rows in the OData feed entity (either a resource or the list of resources). |
|
The request URL to use to obtain the next rows of resource data, if the resource data continues beyond the last row return in the |