Retrieving Data

  Date Updated: August 2014

HTTP GET

Let me GET the content

Use the HTTP GET method to retrieve data from the application. This includes both lists and individual records. For example, you would use the GET method to retrieve a list of invoices made, or the contact details of a customer. API responses are returned in JSON format.

GET one or all?

A GET on resource with id returns single resource.

  • GET {URI}/contacts/1 returns information on the Contact with uid=1

A GET on a collection returns a list of all resources in that collection.

  • GET {URI}/contacts will return a list of all Contacts 
  • The list response follows the below structure where:
    • items is the list of entities returned from the endpoint
    • _links is a list of navigable links
    • page is the paging metadata for this request
      • size is the page size of the current request
      • totalElements is total number of elements in the result set
      • totalPages is total number of pages in the result set
      • number is the page number of the current request
    • 
      {
         "items":[
                   ...
                   { ... },
                   { ... },
                   { ... }
                   ...
         ],
         "_links":[
            {
               "rel":"self",
               "href":"{self_uri}"
            }
         ],
         "page":{
            "size":1,
            "totalElements":9,
            "totalPages":9,
            "number":2
         }
      }
      

Paging

You can control the number of results returned by specifying the page size. The default page size is 400 results and the max page size is 1000 results.

You can also jump to a page by specifying the page number.

Note the URI to the next and previous pages are returned in the _links field (if applicable).


https://api.myob.com/au/essentials/businesses/19/contacts?page=2&size=10

Filtering

You can filter results by adding the filter params to API calls where applicable. This option is used with the following syntax:


filterName=filter_value

Where filterName is the endpoint filter param and filter_value is the value to be filtered by.

Filter params will be documented where available on an endpoint.


For example:
https://api.myob.com/au/essentials/businesses/19/sale/invoices?invoiceNumber=INV00001

OData

The Open Data Protocol (OData) is not supported in the Essentials API at this time.