Upload a Unit

POST /upload

Internal endpoint for iOS app only, to upload a unit from the field.

Headers

application/json

Body

  • latitude number(double) Required
  • longitude number(double) Required
  • image_url string(url) Required

    Uploaded image that the API will read from and download.

  • Hide supervisor attribute Show supervisor attribute object
    • id string(uuid) Required
  • species object
    Hide species attribute Show species attribute object
    • id string(uuid) Required
  • site object Required
    Hide site attribute Show site attribute object
    • id string(uuid) Required
  • Device ID of the mobile device that took the photo.

  • planted_at string(date-time) Required

    Date taken from image metadata, so it's as close to the actual planted date-time as possible.

Responses

POST /upload
curl \
 -X POST https://api.protect.earth/upload \
 -H "Authorization: Bearer $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -H "Idempotency-Key: string" \
 -d '{"latitude":51.87351,"longitude":-1.90973,"image_url":"string","supervisor":{"id":"string"},"species":{"id":"string"},"site":{"id":"string"},"device_id":"string","planted_at":"2019-08-24T14:15:22Z"}'
Request example
# Headers
Idempotency-Key: string

# Payload
{
  "latitude": 51.87351,
  "longitude": -1.90973,
  "image_url": "string",
  "supervisor": {
    "id": "string"
  },
  "species": {
    "id": "string"
  },
  "site": {
    "id": "string"
  },
  "device_id": "string",
  "planted_at": "2019-08-24T14:15:22Z"
}
Response examples (400)
{
  "type": "https://protect.earth/probs/something-went-wrong",
  "title": "You do not have enough credit.",
  "status": 400,
  "detail": "Your current balance is 30, but that costs 50.",
  "instance": "/account/12345/msgs/abc"
}
Response examples (401)
{
  "type": "https://protect.earth/probs/something-went-wrong",
  "title": "You do not have enough credit.",
  "status": 400,
  "detail": "Your current balance is 30, but that costs 50.",
  "instance": "/account/12345/msgs/abc"
}
Response examples (403)
{
  "type": "https://protect.earth/probs/something-went-wrong",
  "title": "You do not have enough credit.",
  "status": 400,
  "detail": "Your current balance is 30, but that costs 50.",
  "instance": "/account/12345/msgs/abc"
}
Response examples (409)
{
  "type": "https://protect.earth/probs/something-went-wrong",
  "title": "You do not have enough credit.",
  "status": 400,
  "detail": "Your current balance is 30, but that costs 50.",
  "instance": "/account/12345/msgs/abc"
}
Response examples (422)
{
  "type": "https://protect.earth/probs/something-went-wrong",
  "title": "You do not have enough credit.",
  "status": 400,
  "detail": "Your current balance is 30, but that costs 50.",
  "instance": "/account/12345/msgs/abc"
}