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:

Applications consuming resources from the OpenAir OData service should consume the data and the metadata jointly.

Note:

The OpenAir 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 or listviews.

    • <resource> is the OData resource name of the resource you are requesting.

    For more information, see Your OpenAir 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

@odata.context

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:

  • If requesting the list of resources in the collection, the response includes the following metadata URL:

    https://honeycomb.app.openair.com/odata/v4/listviews/$metadata

  • If requesting a specific resource, the metadata URL points to the metadata for the requested resource:

    https://honeycomb.app.openair.com/odata/v4/listviews/ $metadata#Collection(OpenAir.OData.V4.ListViews.listview12Row)

For each entity, the metadata includes the list of fields — or Properties — listed in the same order as they appear in the published OpenAir report or list view configuration. Each Property as the following attributes:

  • Name — the field name.

  • Type — the data type e.g Edm.Double for double decimal, Edm.String for string, Edm.Date for date.

value

An array of objects.

  • If requesting the collection, each object correspond to an entity in the collection (either a resource or the list of resources). The objects in the value array have the following properties:

    • kind — The value of this property is always EntitySet.

    • name — The OData resource name. For example, listview12 or list (for the list of resources).

    • url — The relative url path for the OData resource. It is always the same as name.

    • title — The resource title in OpenAir.

  • If requesting the list of resources, each object corresponds to a resource in the collection. The objects in the value array have the following properties:

    • Last Published — The timestamp when the report or list view was last published.

    • PublishType — The scope of use specified for the published report.

    • ID — The published report or list view configuration OData resource ID.

    • Rows — The number of rows of datain the published report (for Reports only).

    • Name — The name of the report or list view configuration.

  • If requesting a specific resource, each object corresponds to a row of data in the resource. The objects properties correspond to the field names or the report or list view column headings.

    Important:

    The object properties or columns in the value array are given in their default order. The order of columns as they appear in the OpenAir report or list view configuration is specified in the metadata. The data types for each column is also provided in the metadata.

@odata.count

The number of rows in the OpenAir OData feed entity (either a resource or the list of resources).

@odata.nextLink

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 value array.

Related Topics:

Viewing Your OpenAir OData Resource Data in a Web Browser
OData Query Options
Reading OpenAir OData Resource Data in Your OpenAir Form and Scheduled Scripts
Exporting OpenAir Published Report Data to NetSuite
Replace Non-Alphanumeric Characters with Underscores in Column Headers and Metadata