Retrieving Data

  Date Updated: November 14th 2014

HTTP GET

Let me GET the content

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

GET one or all?

A GET on resource with id returns single resource.

  • GET {URI}/debtor/1 returns information on the Debtor with ID=1

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

  • GET {URI}/debtor will return a list of all Debtors 
  • GET{URI}/debtor/1/historynote will return a list of all History Notes associated with Debtor 1.

Search

On some endpoints you can search using EXO's inbuilt searching patterns.

To search, add the search query to the endpoint being called using the format {URI}/{endpoint}/search?q={query}

  • GET {URI}/salesorder/search?q=COMFORT will return sales orders matching "COMFORT"
  • GET {URI}/debtor/search?q=ace will return debtors matching "ace"

Paging

Requests that return multiple items will be paginated to 10 items by default. You can jump to a page using the page parameter. In this case, the URIs for the next and previous pages are returned in the header.


https://exo.api.myob.com/debtor?page=7

Note: Page numbering is 1-based. Omitting this parameter returns the first page.

You can customise the page size using the pagesize parameter, up to a maximum of 100:


https://exo.api.myob.com/debtor?pagesize=25

Expanding

Many objects contain the ID of another object in their response properties. Those objects can be expanded inline with the $expand request parameter.


https://exo.api.myob.com/contact/1?$expand

This parameter is available on all API requests and applies to the response of that request only.

Note: PUT and POST works with both expanded and non-expanded subobjects.

Filtering

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


$filter=Attribute operator value

Where Attribute is the endpoint attribute to filter by and operator is one of the supported operators:

  • eq – Equals
  • ne – Not Equals
  • gt – Greater Than
  • ge – Greater Than or Equal
  • lt – Less Than
  • le – Less Than or Equal
  • and – And
  • or – Or
  • The and and or operators can be used to build a filter string that contains multiple filtering conditions:


    https://exo.api.myob.com/debtor?$filter=Active eq true and Balance gt 0

    Filtering is available for the following endpoints and attributes:

  • company - Active, CompanyType, SalesPersonId
  • debtor - Active, SalesPersonId, Balance
  • debtor/{id}/transactions - StatusId, TransactionTypeId
  • debtor/{id}/historynote - SalesPersonId
  • prospect - Active, SalesPersonId
  • stock - Active
  • stockItem - Active
  • bom - Active
  • salesorder - Status, SalesPersonId
  • contact - Active, SalesPersonId
  • activity any attribute
  • Note: Make sure to filter by API attribute names, not by the corresponding fields in the EXO Business database.

    Although out-of-the-box filtering in EXO API is only supported for limited attributes, you can use a workaround to filter on the other attributes available against a specific endpoint. Three rules apply:

    • This is limited to the attributes available against an endpoint
    • You need to use specific alias related to each endpoint in order to access the attributes
    • The name for the field must be the corresponding field name as it exists in the source table, e.g. the SALESORD_HDR table in Exo Business for a salesorder endpoint.

    Below are a few examples of how you would filter on the last_updated field in stockitem, debtor and salesorder endpoints:


    EndpointAliasSample request
    stockitemShttps://exo.api.myob.com/stockitem?$filter=s.last_updated+ge+'2016-01-01'
    debtorAhttps://exo.api.myob.com/debtor?$filter=a.last_updated+ge+'2016-01-01'
    salesorderHhttps://exo.api.myob.com/salesorder?$filter=h.last_updated+ge+'2016-01-01'
    prospectPhttps://exo.api.myob.com/prospect?$filter=p.last_updated+ge+'2016-01-01'
    companyChttps://exo.api.myob.com/company?$filter=c.last_updated+ge+'2016-01-01'
    contactChttps://exo.api.myob.com/contact?$filter=c.last_updated+ge+'2016-01-01'

    Ordering

    You can order results by adding the $orderby option to API calls. This option is used with the following syntax:


    $orderby=Attribute {direction}

    Where Attribute is the endpoint attribute to order results by and direction is either asc or desc to specify ascending or descending order. If no direction is specified, the ordering defaults to ascending.

    Multiple attributes can be specified, separated by commas—the returned results will be ordered by the first attribute specified, then by the second and so on. For example:


    https://exo.api.myob.com/salesorder?$orderby=Status asc, Id asc

    Ordering is available for the following endpoints and attributes:

  • company - AccountName, CompanyType, Id
  • debtor - AccountName, Balance, Id
  • debtor/{id}/transactions - DueDate, InvoiceNumber, Amount, OutstandingAmount, TransactionTypeId
  • debtor/{id}/historynote - Date, SalesPersonId, Subject
  • prospect - AccountName, Id
  • stock - Stockcode, Description
  • stockitem - Stockcode, Description
  • bom - Stockcode, Description
  • salesorder - Id, Status, DueDate, AccountName
  • contact - Fullname
  • activity - any attribute
  • OData

    The Open Data Protocol (OData) is not supported in the EXO API at this time. However, because MYOB Exo Business runs as a SQL Server database, if your aim was to use OData for reporting, we would generally recommend a direct SQL connection instead.  Schema references are available on the Exo Business Education Centre.