Skip to main content

API Examples

Create GDD APS Job

  curl --location --request POST '{ADMA_INSTANCE_URL}/solutions/bayerAgPowered.gdd:create?api-version=
{ADMA_API_VERSION}' \
--header 'Authorization: Bearer {TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestPath": "/v1/gdd/1234",
"partnerRequestBody": {
"partyId": "53b8f2b9-04b3-4462-ac52-9c821feb0ee2",
"gddStartDate": "2023-05-01",
"gddEndDate": "2023-07-15",
"resourceId": "dfa70d7c-5132-4949-bc2d-92906c838d22",
"resourceType": "Field",,
"crop": "CANOLA",
"temperatureUnit": "c"
}
}'

Create Job Response Sample


{
"id": "1234",
"message": "GDD-01001: Job queued successfully.",
"status": "WAITING",
"jobCreatedDateTime": "2023-04-28T00:00:00Z",
"jobLastActionDateTime": "2023-04-28T00:27:00Z",
"e2eid": "a1853978d9ae412ccd55923ca41891c7",
"partnerRequestBody": {
"solutionId": "bayerAgPowered.gdd",
"partyId": "53b8f2b9-04b3-4462-ac52-9c821feb0ee2",
"gddStartDate": "2023-05-01",
"gddEndDate": "2023-07-15",
"resourceId": "dfa70d7c-5132-4949-bc2d-92906c838d22",
"resourceType": "Field",
"crop": "CANOLA",
"temperatureUnit": "c",
"method": "standard"
}
}

Fetch GDD Insights 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.gdd:fetch?api-version=2022-11-01-preview' \
--header 'Authorization: Bearer <JWT>' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestPath":"/v1/gdd/1234"
}'

Fetch Job Status Response Sample

{
"id": "1234",
"message": "GDD-02001: Job is completed successfully",
"status": "SUCCEEDED",
"insightId": "2e130d6c-13ae-4e2e-875b-3a8f018f1ffd",
"jobCreatedDateTime": "2023-04-28T00:00:00Z",
"jobProcessingStartDateTime": "2023-04-28T00:05:00Z",
"jobProcessingEndDateTime": "2023-04-28T00:27:00Z",
"jobLastActionDateTime": "2023-04-28T00:27:00Z",
"jobProcessingddrationInSeconds": 22,
"e2eid": "a1853978d9ae412ccd55923ca41891c7",
"partnerRequestBody": {
"solutionId": "bayerAgPowered.gdd",
"partyId": "53b8f2b9-04b3-4462-ac52-9c821feb0ee2",
"gddStartDate": "2023-05-01",
"gddEndDate": "2023-07-15",
"crop": "CANOLA",
"resourceId": "dfa70d7c-5132-4949-bc2d-92906c838d22",
"resourceType": "Field",
"temperatureUnit": "c",
"method": "STANDARD"
}
}

Cancel GDD APS 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.gdd:cancel?api-version=
{ADMA_API_VERSION}' \
--header 'Authorization: Bearer {TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"requestPath":"/v1/gdd/1234"
}'

Cancel Job Response Sample

{
"id": "1234",
"message": "GDD-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": {
"solutionId": "bayerAgPowered.gdd",
"partyId": "53b8f2b9-04b3-4462-ac52-9c821feb0ee2",
"gddStartDate": "2023-05-01",
"gddEndDate": "2023-07-15",
"crop": "CANOLA",
"resourceId": "dfa70d7c-5132-4949-bc2d-92906c838d22",
"resourceType": "Field",
"temperatureUnit": "c",
"method": "STANDARD"
}
}

Get GDD APS Output

The GDD APS produces a single value of the calculated Growing Degree Days stored in a JSON output. This JSON can be accessed via the ADMA Insights API.

Insights API Request Sample

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

Response Sample

The calculated GDD Value for the job can be retrieved from measurements.computedGdd.value.

{
"partyId": "53b8f2b9-04b3-4462-ac52-9c821feb0ee2",
"modelId": "bayerAgPowered.gdd",
"resourceType": "Field",
"resourceId": "4b879eea-1c04-45c5-8669-cb608529c0f8",
"modelVersion": "12",
"attachmentsLink": "https://dfs-fb-prod-instance.farmbeats.azure.net/parties/53b8f2b9-04b3-4462-ac52-9c821feb0ee2/models/bayerAgPowered.gdd/resource-types/Field/resources/4b879eea-1c04-45c5-8669-cb608529c0f8/insight-attachments?api-version=2023-07-01-preview&insightIds=12_14_1008",
"insightStartDateTime": "2023-07-01T00:00:00Z",
"insightEndDateTime": "2023-07-15T00:00:00Z",
"measurements": {
"computedGdd": {
"unit": "C",
"value": 295.0
}
},
"id": "2e130d6c-13ae-4e2e-875b-3a8f018f1ffd",
"status": "SUCCEEDED",
"createdDateTime": "2024-04-15T19:40:16Z",
"modifiedDateTime": "2024-04-15T19:40:16Z",
"eTag": "4a041af6-0000-0100-0000-661d82a00000",
"createdBy": "09f43fb7-fb08-4131-ae42-99e001a9abc6",
"modifiedBy": "09f43fb7-fb08-4131-ae42-99e001a9abc6"
}