Improvements to the REST API

Today, we've rolled out several new improvements to the REST API.


Fulfil REST API has a powerful search mechanism through a filters array, that mimics how a SQL where clause works. This is great for advanced use cases, but made simple searches like order created after a time or fetching a list of records more complicated than it should be.

Starting today, the API supports a simpler search system by providing URL parameters.


Search for products that were created after a certain date

GET /model/product.product?created_at_min=2019-04-11T12:30

Ability to specify the fields

GET /model/product.product?fields=variant_name,code


        "code": "20000504",
        "id": 5565,
        "rec_name": "[20000504] NEW 2MBI150UA-120-50 Apple X",
        "variant_name": "NEW 2MBI150UA-120-50 Apple X"
        "code": "20000505",
        "id": 5566,
        "rec_name": "[20000505] NEW 2MBI150UM-120 Apple X",
        "variant_name": "NEW 2MBI150UM-120 Apple X"
        "code": "20000511",
        "id": 5572,
        "rec_name": "[20000511] NEW 2MBI150VA120-50 Apple X",
        "variant_name": "NEW 2MBI150VA120-50 Apple X"

rec_name and id are always returned

Fetch a list of records

GET /model/product.product?fields=code,variant_name&ids=5563,5564


        "code": "20000502",
        "id": 5563,
        "rec_name": "[20000502] NEW 2MBI150UA-120 Apple",
        "variant_name": "NEW 2MBI150UA-120 Apple"
        "code": "20000503",
        "id": 5564,
        "rec_name": "[20000503] NEW 2MBI150UA-120-01 Apple X",
        "variant_name": "NEW 2MBI150UA-120-01 Apple X"

Other useful search properties

Field Description
ids Retrieve certain records specified by a comma-separated list of ids
per_page The maximum number of records to show per page. (Capped at 500)
page The page to return
since_id Show records after the specified ID.
created_at_min Show records created at or after date (format: 2019-04-25T10:15:47)
created_at_max Show records created at or before date (format: 2019-04-25T10:15:47)
updated_at_min Show records created at or before date (format: 2019-04-25T10:15:47)
updated_at_max Show records created at or before date (format: 2019-04-25T10:15:47)

You can also filter by any other field on a record

GET /model/

Will return orders in the draft state.

Filter using attribute/relationship

GET /model/

Returns orders where the invoice address' country code is the US.

Advanced filtering

The advanced filtering using the array will continue to work.