URL parameters |
You'll be required to supply parameters when
building the URL for your requests. These are
refered to as URL parameters. Each request will
require specific parameters as outlined in the
API Reference.
You'll see placeholders for the specific
parameters required for each request. Here's an
example:
/operators/{operatorId}/aircraft/{aircraftId}
In the above URL, there are 2 required
parameters, operatorId and aircraftId. You'll
need to replace these placeholders with real
data from your Flight Schedule Pro account.
After you do this, the above URL should look
like this:
/operators/45587/aircraft/c804ad93-d8c6-41f8-9180-86f85b180fb1
|
Query string parameters |
Query string parameters are used for filtering,
pagination, sorting and creating partial
responses. You append query string parameters to
the end of your URLs. Start your parameters with
a '?' character and separate them using '&'
characters.
/operators/45587/aircraft/d8c6-41f8-9180-86f85b180fb1?para=1234&secpar;=3433
|
Filtering |
Some resources can be filtered. For example, you
can return a list of aircraft that have flown
less than 1000 total hours. To do this, you
would make the following request:
/operators/45587/aircraft?totalHours=lt:1000
The
API Reference
will list out supported filters for each
endpoint.
|
Pagination |
You can use pagination to reduce the number of
results that are returned when making requests
that return arrays. We use 'limit' and 'offset'
query string parameters for pagination. Limit is
used to specify how many items should be
returned. Offset is used to specify where in the
list you want to start returning results. The
following URL uses pagination:
/operators/45587/aircraft?limit=100&offset;=2
The
API Reference
will tell you if pagination is supported for a
given endpoint and what the default values are
if supported.
|
Partial responses |
Some endpoints allow you specify what data you
want returned in the response. This is helpful
when the resource you are requesting has a large
response but you only need a subset of the data
returned in the response. We use the 'fields'
query string to specify what data should be
returned in the response. The 'fields' query
string should contain a comma separated list of
fields you want returned. The following URL
returns a partial response:
/operators/45587/aircraft?fields=name,tailnumber
The
API Reference
will tell you if partial responses are supported
for a given endpoint and what the default values
are if supported.
|
Sorting |
Some endpoints allow you to sort the items
returned in the response. We use the 'sortBy'
query string to specify how array items should
be sorted. The 'sortBy' query string should
contain the field name you want to sort by. The
following URL returns a sorted response:
/operators/45587/flights?sortBy=startTime
The
API Reference
will tell you if sorting is supported for a
given endpoint and what the default and
available values are.
|
Request body parameters |
You may be required to supply request body
parameters when making POST, PUT and PATCH
calls. These parameters must be in JSON format.
The
API Reference
outlines which parameters are available and
required for each endpoint. Here's a example
POST request body for creating a new aircraft:
{
"name" : "Piper Warrior III",
"type" : "ASEL",
"tailNumber" : "N92555"
}
|
|