Beta > Prescriptions Endpoints

About

All HTTP methods should be prepended by this service's endpoint:

https://api.withleaf.io/services/beta/prescription/api

See below the REST resources and their endpoints available in this service.

Prescription (BETA)

This feature has the following endpoints available:

DescriptionEndpoints
Upload prescription to Raven SlingshotPOST /users/{leafUserId}/ravenSlingshot
List prescriptions from Raven SlingshotGET /users/{leafUserId}/ravenSlingshot
Lists prescriptions from John DeereGET /users/{leafUserId}/johnDeere
Upload prescription to John DeerePOST /users/{leafUserId}/johnDeere
Download prescription from John DeereGET /users/{leafUserId}/johnDeere/download
Upload prescription to CNHiPOST /users/{leafUserId}/cnhi
List prescriptions from CNHiGET /users/{leafUserId}/cnhi
Upload prescription to Climate FieldViewPOST /users/{leafUserId}/climateFieldView
Upload prescription to TrimblePOST /users/{leafUserId}/trimble
Upload prescription to AgLeaderPOST /users/{leafUserId}/agleader

Upload prescription to Raven Slingshot

 POST /users/{leafUserId}/ravenSlingshot

Upload a prescription using the Raven Slingshot credentials of the LeafUserId.

The file to be uploaded needs to be .zip and contain one of each of the following file extension: shp, dbf, shx; and all files must have the same name. The zip file cannot contain subfolders.

Example:

A zip file named “prescription_rx_map”, containing the following files:

  • prescription_rx_map.shp
  • prescription_rx_map.dbf
  • prescription_rx_map.shx

Request examples

curl -X POST \
-H 'Authorization: Bearer YOUR_TOKEN' \
-F 'file=prescription_rx_map.zip' \
'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/ravenSlingshot'

Response

{
"id": "str",
"name": "str"
}

List prescriptions from Raven Slingshot

 GET /users/{leafUserId}/ravenSlingshot

List the existing prescriptions available in the provider.

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/ravenSlingshot'

Response

[
{
"id": "str",
"name": "str"
},
{
"id": "str",
"name": "str"
}
]

Upload prescription to John Deere

 POST /users/{leafUserId}/johnDeere

Upload a prescription using the John Deere credentials of the LeafUserId.

There is a required request parameter called organizationId for this endpoint to work. This property should be the id of the organization at JohnDeere.

The file to be uploaded needs to be .zip and have a folder called "Rx" containing one of each of the following file extension: shp, dbf, shx; and all files must have the same name. The zip file cannot contain subfolders.

Example:

A .zip file named “prescription_rx_map”, having a parent folder called "Rx", containing the following files:

  • Rx/
    • prescription_rx_map.shp
    • prescription_rx_map.dbf
    • prescription_rx_map.shx

Request examples

curl -X POST \
-H 'Authorization: Bearer YOUR_TOKEN' \
-F 'file=prescription_rx_map.zip' \
'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/johnDeere?organizationId={organizationId}'

Response

{
"id": "str",
"name": "str"
}

List prescriptions from John Deere

 GET /users/{leafUserId}/johnDeere

List the existing prescriptions available in the provider.

There is a required request parameter called organizationId for this endpoint to work. This property should be the id of the organization at JohnDeere.

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/johnDeere?organizationId={organizationId}'

Response

[
{
"id": "str",
"name": "str"
},
{
"id": "str",
"name": "str"
}
]

Download prescription from John Deere

 GET /users/{leafUserId}/johnDeere/download

Download a prescription related to a file ID using the LeafUserId's John Deere credentials. This file ID is relative to the one available from the John Deere side.

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/johnDeere/download?fileId={fileId}'

Response

{
"fileUrl": "url_to_download"
}

Upload prescription to CNHi

 POST /users/{leafUserId}/cnhi

Upload a prescription using the CNHi credentials of the LeafUserId.

You can get the company Id from the grower endpoints using the property providerOrganizationId.

The file to be uploaded must be a .zip and contain each of the following file extension: shp, dbf and shx. All files must have the same name. The zip file cannot contain subfolders.

Example:

A .zip file named “prescription_map” containing the following files:

  • prescription_map.shp
  • prescription_map.dbf
  • prescription_map.shx

Request examples

curl -X POST \
-H 'Authorization: Bearer YOUR_TOKEN' \
-F 'file=prescription_map.zip' \
'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/cnhi?companyId={companyId}'

Response

{
"id": "str",
"name": "str"
}

List prescriptions from CNHi

 GET /users/{leafUserId}/cnhi

List the existing prescriptions available in the provider.

You can get the company Id from the grower endpoints using the property providerOrganizationId.

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/cnhi?companyId={companyId}'

Response

[
{
"id": "str",
"name": "str"
},
{
"id": "str",
"name": "str"
}
]

Upload prescription to Climate FieldView

 POST /users/{leafUserId}/climateFieldView

Upload a prescription using the Climate FieldView credentials of the LeafUserId.

The file to be uploaded needs to be .zip and contain one of each of the following file extension: shp, dbf, shx; and all files must have the same name. The zip file cannot contain subfolders.

Example:

A zip file named “prescription_rx_map”, containing the following files:

  • prescription_rx_map.shp
  • prescription_rx_map.dbf
  • prescription_rx_map.shx

Request examples

curl -X POST \
-H 'Authorization: Bearer YOUR_TOKEN' \
-F 'file=prescription_rx_map.zip' \
'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/climateFieldView'

Response

{
"id": "str",
"name": "str"
}

Upload prescription to Trimble

 POST /users/{leafUserId}/trimble

Upload a prescription using the Trimble credentials of the LeafUserId.

The file to be uploaded needs to be .zip and contain one of each of the following file extension: shp, dbf, shx; and all files must have the same name. The zip file cannot contain subfolders.

Also, in Raven's case the user must fill the rateAttribute and rateUnit as required parameters within the URL. An optional parameter is the fileName.

The rateAttribute must contain the name of the column from the Shapefile.

The rateUnit must contain one the values in the table below

rateUnit
gal/ac
l/ha
lbs/ac
ton/ac
kg/ha
t/ha
kS/ac
kS/ha
lbs(N)/ac
kg(N)/ha
S/ha
S/ha

Example:

A zip file named “prescription_rx_map”, containing the following files:

  • prescription_rx_map.shp
  • prescription_rx_map.dbf
  • prescription_rx_map.shx

Request examples

curl -X POST \
-H 'Authorization: Bearer YOUR_TOKEN' \
-F 'file=prescription_rx_map.zip' \
'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/trimble?rateAttribute={}&rateUnit={}'

Response

{
"id": "str",
"name": "str"
}

Upload prescription to AgLeader

 POST /users/{leafUserId}/agleader

Upload a prescription using the AgLeader credentials of the LeafUserId.

The file to be uploaded needs to be .zip and contain one of each of the following file extension: shp, dbf, shx; and all files must have the same name. The zip file cannot contain subfolders.

Example:

A zip file named “prescription_rx_map”, containing the following files:

  • prescription_rx_map.shp
  • prescription_rx_map.dbf
  • prescription_rx_map.shx

Request examples

curl -X POST \
-H 'Authorization: Bearer YOUR_TOKEN' \
-F 'file=prescription_rx_map.zip' \
'https://api.withleaf.io/services/beta/prescription/api/users/{leafUserId}/agleader'

Response

{
"id": "str",
"name": "str"
}