API is fundamental in Griley Air Freight's functionality and service. We use the API which is documented here for our own use. E.g. our entire webapp is built using this very API!
The purpose of our customer API is to give all customers the ability to create orders in our system without us needing to set anything up. All customers can just do it easily. We do not expect our customers to pull data from our system, although it is possible, we are fully capable of updating our customers databases through their API and that is our preference in practice.
A fair warning: API Usage is monitored and if customers are interacting with the API we will know. All requests are logged.
Griley Air's API is a REST oriented service designed to be completely open and easy to access. As a company we have invested very heavily into our API, so much so that our own apps work on the same API we are documenting here.
Currently we are running v1 of our api. You will see all queries are going to /api/v1. We will continuously keep adding to our v1 of the API. We do not expect version to be incremented but if so we would reach out to all clients respectively before any changes were made.
Depending on why you need to build an integration with Griley Air Freight, you currently have two options:
If you are building an integration with Griley Air you should use a permanent token. This once-off and you really don't have to worry about the OAuth dance.
Permanent token will never expire!
Steps:
To set yourself up for development mode you will need to have an API Key. Next you will need to add they key "Demo" to your header. This will route all your requests to a public sandbox account. Here is a sample on how to perform this:
Method | Endpoint | Summary |
---|---|---|
GET |
/api/v1/who_am_i |
Get details for your access connection.
Basic user info and security access level.
|
GET |
/api/v1/ << RESOURCE >> /INFO | Get details for a specific resource. This will show all resource attributes and their types. |
POST |
/api/v1/ << RESOURCE >> /QUERY | Query a specific resource. This will return a list of resource objects. Queries can be made on any resource by any data attribute. |
POST |
/api/v1/ << RESOURCE >> | Post data or create a resource object. Currently users create api_transfer_orders objects. Send a blank POST to the resource to get the required attributes to create a new order. |
We are releasing this working API to all customers. But if you need something else, contact us, anything is possible. We are always happy to help. |
The query is used to query a specific resource. All resources have a query endpoint. Here is a sample payload for a query on api_freight_bill:
{ "query": [ { "field": "pronumber", "operator": "eq", "value": "123456789" }, { "field": "status", "operator": "eq", "value": "PENDING" } ] }
The query is an array of objects. Each object has a field, operator, and value. The field is the name of the attribute to query. The operator is the comparison operator. The value is the value to compare the attribute to.
**Queries can only be made on data attributes, not relationships. We will futher develop this feature in the future to allow for queries on relationships.
Note: In the headers['Authorization'] there should be one space between API_KEY and << ACTUAL KEY >>. If you are using OAuth2 you will replace API_KEY with OAUTH.