Send your first request
Before you start
Before you make your first API request, you need:
-
Access details for authentication — see Authentication.
-
Installed
curlutility — this example uses thecurlcommand-line utility to invoke the API.
Invoke the listContracts operation
To invoke the listContracts operation:
-
On a Linux or UNIX platform, set the following environment variables, using the values from your access details:
export TOKEN_URL="XXXXXXXXXX" export BASE64_KEY="XXXXXXXXXX" export API_BASE_URL="https://platform.iceye.com" -
Send a request to the Token endpoint to obtain an access token:
curl --request POST \ --url "${TOKEN_URL}" \ --header "Accept: application/json, application/problem+json" \ --header "Authorization: Basic ${BASE64_KEY}"" \ --header "Cache-Control: no-cache" \ --header "Content-Type: application/x-www-form-urlencoded" \ --data "grant_type=client_credentials"If the request is successful, you should receive a response like the following:
{ "token_type":"Bearer", "expires_in":3600, "access_token":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "scope": "catalog.read deliveries.read orders.read activities.read contracts.read internal_options.read customers.read internal_options.write" } -
Extract the
access_tokenproperty from the authentication response and use it to define theAPI_ACCESS_TOKENenvironment variable:export API_ACCESS_TOKEN="XXXXXXXXXX" -
Invoke the
listContractsoperation, as follows:curl --location "${API_BASE_URL}/api/company/v1/contracts" \ --header "Accept: application/json, application/problem+json" \ --header "Authorization: Bearer ${API_ACCESS_TOKEN}"
Contract IDs
If successful, the response to the listContracts invocation contains a list of one or more contracts associated with the current user’s company:
{
"data": [
{
"id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXX",
"name": "string",
...
}
],
"cursor": "string"
}
Each of the listed contracts has an id property, which defines the contract ID for that contract.
Contracts play a crucial role in the ICEYE Constellation API Suite (ICAS), because they define constraints that affect the parameter values you are allowed to set in API requests.
| Make a note of the contract ID and store it in a safe place. For many of the ICEYE API operations, the contract ID is a required parameter. |