Skip to main content

API Examples

Create CWUM APS Job

Clients call this endpoint to submit a Job to generate an APS insight based on the paramaters passed in the body.

  curl --location --request POST '{ADMA_INSTANCE_URL}/solutions/bayerAgPowered.cwum:create?api-version={ADMA_API_VERSION}' \
--header 'Authorization: Bearer {TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestPath": "/v1/cwum-add-on/1234",
"partnerRequestBody": {
"partyId": "53b8f2b9-04b3-4462-ac52-9c821feb0ee2",
"sceneStartDateTime": "2023-01-01T00:00:00",
"sceneEndDateTime": "2023-01-15T23:59:59",
"collection": "sentinel-2-l2a",
"layer": "SCOUTING_MAP",
"resourceId": "dfa70d7c-5132-4949-bc2d-92906c838d22",
"resourceType": "Field"
}
}'

Create Job Response Sample


{
"id": "1234",
"message": "IMG-01001: Job queued successfully.",
"status": "WAITING",
"jobCreatedDateTime": "2023-04-28T00:00:00Z",
"jobLastActionDateTime": "2023-04-28T00:27:00Z",
"e2eid": "a1853978d9ae412ccd55923ca41891c7",
"partnerRequestBody": {
"partyId": "53b8f2b9-04b3-4462-ac52-9c821feb0ee2",
"resourceId": "dfa70d7c-5132-4949-bc2d-92906c838d22",
"resourceType": "Field",
"collection": "sentinel-2-l2a",
"layer": "SCOUTING_MAP",
"sceneStartDateTime": "2023-01-01T00:00:00",
"sceneEndDateTime": "2023-01-15T23:59:59"
}
}

Fetch CWUM APS Job Status

Clients fetch the status of their submitted job using the Fetch Status endpoint. When a job is in a SUCCEEDED state, the response will provide the Insight ID which can be used to retrieve the outputs of the job. Please review Retrieve APS Outputs for details.

Possible status values are: WAITING, RUNNING, SUCCEEDED, FAILED, CANCELLED

curl --location --request POST '<ADMA Instance URL>/solutions/bayerAgPowered.cwum:fetch?api-version=2022-11-01-preview' \
--header 'Authorization: Bearer <JWT>' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestPath":"/v1/cwum-add-on/1234"
}'

Fetch Job Status Response Sample

{
"id": "1234",
"message": "IMG-02001: Job is completed successfully",
"status": "SUCCEEDED",
"jobCreatedDateTime": "2023-04-28T00:00:00Z",
"jobProcessingStartDateTime": "2023-04-28T00:05:00Z",
"jobProcessingEndDateTime": "2023-04-28T00:27:00Z",
"jobLastActionDateTime": "2023-04-28T00:27:00Z",
"jobProcessingDurationInSeconds": 22,
"e2eid": "a1853978d9ae412ccd55923ca41891c7",
"partnerRequestBody": {
"partyId": "53b8f2b9-04b3-4462-ac52-9c821feb0ee2",
"collection": "sentinel-2-l2a",
"layer": "SCOUTING_MAP",
"sceneStartDateTime": "2023-01-01T00:00:00",
"sceneEndDateTime": "2023-01-15T23:59:59",
"resourceId": "dfa70d7c-5132-4949-bc2d-92906c838d22",
"resourceType": "Field"
}
}

Cancel CWUM APS Job

Clients can call this endpoint to cancel a previously created Job. Jobs can only be cancelled if they are in a cancellable state: WAITING or RUNNING.

curl --location --request POST '{ADMA_INSTANCE_URL}/solutions/bayerAgPowered.cwum:cancel?api-version={ADMA_API_VERSION}' \
--header 'Authorization: Bearer {TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestPath":"/v1/cwum-add-on/1234"
}'

Cancel Job Response Sample

{
"id": "1234",
"message": "IMG-02002: Job is cancelled successfully.",
"status": "CANCELLED",
"jobCreatedDateTime": "2023-04-28T00:00:00Z",
"jobLastActionDateTime": "2023-04-28T00:27:00Z",
"jobProcessingStartDateTime": "2023-04-28T00:05:00Z",
"jobProcessingEndDateTime": "2023-04-28T00:27:00Z",
"jobProcessingDurationInSeconds": 22,
"e2eid": "a1853978d9ae412ccd55923ca41891c7",
"partnerRequestBody": {
"partyId": "53b8f2b9-04b3-4462-ac52-9c821feb0ee2",
"collection": "sentinel-2-l2a",
"layer": "SCOUTING_MAP",
"sceneStartDateTime": "2023-01-01T00:00:00",
"sceneEndDateTime": "2023-01-15T23:59:59",
"resourceId": "dfa70d7c-5132-4949-bc2d-92906c838d22",
"resourceType": "Field"
}
}

Insight Attachment API: Get Outputs

Insight Attachment API Calls

To get the generated image and metadata, customers need to use the ADMA InsightAttachments endpoints.

Request Sample

curl --location --request GET '{ADMA_INSTANCE_URL}/parties/{PARTY_ID}/models/bayerAgPowered.
cwum/resource-types/Field/resources/
{FIELD_ID}/insight-attachments?api-version={ADMA_API_VERSION}'
--header 'Content-Type: application/json'
--header 'Authorization: Bearer {TOKEN}'

The partyId and fieldId parameters are the same as the ones used when requesting the image in the PUT request. This endpoint will return a list of Insight Attachments with the following format:

{
"value": [
{
"insightId": "2110_461",
"modelId": "bayerAgPowered.cwum",
"originalFileName": "CROP_WATER_USE_MAP-aa1aa11a-u579-0e3k-w13k-89pr45gv45j2.png",
"id": "a5bf6ad6-f378-47d0-929c-9ba437322c8e",
...
},
{
"insightId": "2110_461",
"modelId": "bayerAgPowered.cwum",
"originalFileName": "CROP_WATER_USE_MAP-metadata-aa1aa11a-u579-0e3k-w13k-89pr45gv45j2.json",
"id": "44a2c120-3ce2-4533-a4fe-a7791efb358f",
...
},
...
]
}