Agworld API Documentation

Introduction

The Agworld API is an implementation of the JSON API specification. It is currently Read-Only.

URL

In the examples below, please substitute <url> with the appropriate url for the instance that you are connecting with. A non-exhaustive list of Agworld instances is listed below:

  • Australia - https://my.agworld.com.au
  • The United States - https://us.agworld.co
  • New Zealand - https://nz.agworld.co

Content-Type

Clients must include the following headers with every POST, and PATCH request:

Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

The API will include the following headers with each response:

Content-Type: application/vnd.api+json

Authentication

Authentication is based on Oauth2 workflow. To authenticate the request on the user’s behalf, the appropriate JWT token must be obtained. The implementation provider documentation describing this process is here

To register a 3rd party web-based application, take the following steps:

  1. Provide Agworld with your site’s URLs - in particular, the Oauth2 callback and logout URLs
  2. Agworld will register the application and provide you with client_id, client_secret and the base URL for authentication requests

Using the credentials provided, you then need to obtain user authorisation, see here. The required Oauth2 scope is openid. For non-prodiction environment, it is recommended to add the email scope as well to mitigate the environment’s volatility.

Using the code in the callback URL handler of your application, you can get the access token, see here

Token should be used as an Authorization (for non-production Agworld environments use X-Authorization) header parameter when requesting Agworld API resources:

curl <url>/api/fields \
-H 'Authorization: Bearer <token>'

Requests signed with this token would be run in the context of the user and provide the data available to that user, same data as in Agworld website or Agworld mobile application.

Usage Limits

Please limit your integration to as few concurrent requests as possible.

The limit on concurrent API calls from the same developer key is 4.

The total rate limit is 200 requests per minute and 5000 requests per hour.

Features

The following JSON API functionality is implemented for each resource’s endpoints (index and show). Please check the JSON API specification for more detail on each of these options.

Note The URL’s passed to curl below are not URL-encoded. This makes reading them easier but it means that they will need to be properly encoded before using them yourself. For example [ and ] become %5B and %5D respectively.

  • filter (index only)

    Allows the filtering of the records returned in the response by the specified attribute. The list of filterable attributes is defined for each resource in its specific section.

      curl <url>/api/farms?filter[name]=Home \
      -H 'Authorization: Bearer <token>'
    
  • sorting (index only)

    Allows the sorting of the records in the response by the specified attribute. The list of sortable attributes is defined for each resource in its specific section.

      curl <url>/api/farms?sort=name \
      -H 'Authorization: Bearer <token>'
    
  • pagination (index only)

    The Agworld API uses pagination for each index endpoint with a default page size of 10 and a maximum of 100. To fetch a specific page, a client should provide a page[number] parameter. It is also possible to optionally override the size of the page returned by providing a page[size] parameter.

      curl '<url>/api/farms?page[number]=2&page[size]=5' \
      -H 'Authorization: Bearer <token>'
    
  • include

    For convenience, it is possible to side-load related records in the same request. Side-loadable records for any given resource, match those shown in the relationships for that resource (note whether type is pluralised).

      curl <url>/api/farms?include=grower \
      -H 'Authorization: Bearer <token>'
    
  • fields

    For efficiency, it is possible to only return a subset of the fields available on a resource. The list of visible attributes is defined for each resource in its specific section.

      curl '<url>/api/farms?fields[farms]=name' \
      -H 'Authorization: Bearer <token>'
    

User

Fetch details for the currently logged in user

Endpoint

GET api/user

Request

Route

GET api/user

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique id of the user.
  • name
    Name of the user.
  • branch_id
    Unique id of the branch that the user belongs to.
  • organisation_id
    Unique id of the head office of the branch that the user belongs to.
  • organisation_name
    Name of the head office of the branch that the user belongs to.
  • is_grower_organisation
    Flag to indicate whether or not the user belongs to a grower organisation.
  • created_at
    Timestamp of user creation.
  • updated_at
    Timestamp of last user update.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "100000",
    "type": "users",
    "attributes": {
      "name": "Agworld Farmer",
      "branch_id": 100001,
      "is_grower_organisation": true,
      "organisation_id": "100002",
      "organisation_name": "Testing Grower Co. Head Office",
      "created_at": "2011-06-15",
      "updated_at": "2011-06-15"
    },
    "links": {
      "self": "http://localhost:3000/api/users/100000"
    }
  },
  "meta": {}
}

Growers

Fetch details for the specified grower

Endpoint

GET /api/growers/:id

Parameters

  • required id
    Unique id of the grower

Request

Route

GET /api/growers/100001

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique id of the grower
  • name
    Name of the grower.
  • description
    Description of the grower.
  • business_identifier
    Government provided business identifier. e.g. EIN in USA, ABN in Australia.
  • organisation_id
    Unique id of the company head office.
  • created_at
    Timestamp of grower creation.
  • updated_at
    Timestamp of last grower update.

Relationships

  • farms
    Farms that belong to this grower.
  • fields
    Fields that belong to this grower.
  • field_boundaries
    Field boundaries that belong to this grower.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "100001",
    "type": "growers",
    "attributes": {
      "name": "Testing Grower Co.",
      "description": "My little farm.",
      "created_at": "2011-06-15T02:30:00+00:00",
      "updated_at": "2011-06-15T02:30:00+00:00",
      "business_identifier": "12345678900",
      "organisation_id": "100001"
    },
    "relationships": {
      "fields": {
        "links": {
          "related": "http://localhost:3000/api/fields?filter[grower_id]=100001"
        }
      },
      "field_crops": {
        "links": {
          "related": "http://localhost:3000/api/field_crops?filter[grower_id]=100001"
        }
      },
      "farms": {
        "links": {
          "related": "http://localhost:3000/api/farms?filter[grower_id]=100001"
        }
      },
      "prescriptions": {
        "links": {
          "related": "http://localhost:3000/api/prescriptions?filter[grower_id]=100001"
        }
      },
      "field_boundaries": {
        "links": {
          "related": "http://localhost:3000/api/field_boundaries?filter[grower_id]=100001"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/growers/100001"
    }
  },
  "meta": {}
}

Fetch list of growers

Endpoint

GET /api/growers

Parameters

  • filter[name]
    Filter the result by the name or part of the name.
  • filter[business_identifier]
    Filter result by the unique business identifier.
  • filter[updated_after]=yyyy-mm-ddThh:mm:ss+hh:mm
    Filter to growers that have had direct attributes updated after this time.

Request

Route

GET /api/growers

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique id of the grower
  • name
    Name of the grower.
  • description
    Description of the grower.
  • business_identifier
    Government provided business identifier. e.g. EIN in USA, ABN in Australia.
  • organisation_id
    Unique id of the company head office.
  • created_at
    Timestamp of grower creation.
  • updated_at
    Timestamp of last grower update.

Relationships

  • farms
    Farms that belong to this grower.
  • fields
    Fields that belong to this grower.
  • field_boundaries
    Field boundaries that belong to this grower.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "100001",
      "type": "growers",
      "attributes": {
        "name": "Testing Grower Co.",
        "description": "My little farm.",
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "business_identifier": "12345678900",
        "organisation_id": "100001"
      },
      "relationships": {
        "fields": {
          "links": {
            "related": "http://localhost:3000/api/fields?filter[grower_id]=100001"
          }
        },
        "field_crops": {
          "links": {
            "related": "http://localhost:3000/api/field_crops?filter[grower_id]=100001"
          }
        },
        "farms": {
          "links": {
            "related": "http://localhost:3000/api/farms?filter[grower_id]=100001"
          }
        },
        "prescriptions": {
          "links": {
            "related": "http://localhost:3000/api/prescriptions?filter[grower_id]=100001"
          }
        },
        "field_boundaries": {
          "links": {
            "related": "http://localhost:3000/api/field_boundaries?filter[grower_id]=100001"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/growers/100001"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/growers?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/growers?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/growers?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Farms

Fetch details for the specified farm

Endpoint

GET /api/farms/:id

Parameters

  • required id
    Unique id of the farm

Request

Route

GET /api/farms/100000

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique id of the farm
  • name
    Name of the farm.
  • description
    Description of the farm.
  • created_at
    Timestamp of farm creation.
  • updated_at
    Timestamp of last farm update.

Relationships

  • grower
    Grower that this farm belongs to.
  • fields
    Fields that belong to this farm.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "100000",
    "type": "farms",
    "attributes": {
      "name": "Orange Farm",
      "description": "South of the river.",
      "created_at": "2011-06-15T02:30:00+00:00",
      "updated_at": "2011-06-15T02:30:00+00:00"
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/100001"
        }
      },
      "fields": {
        "links": {
          "related": "http://localhost:3000/api/fields?filter[farm_id]=100000"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/farms/100000"
    }
  },
  "meta": {}
}

Fetch list of farms

Endpoint

GET /api/farms

Parameters

  • filter[name]
    Filter the result by the name or part of the name.
  • filter[updated_after]=yyyy-mm-ddThh:mm:ss+hh:mm
    Filter to farms that have had direct attributes updated after this time.

Request

Route

GET /api/farms

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique id of the farm
  • name
    Name of the farm.
  • description
    Description of the farm.
  • created_at
    Timestamp of farm creation.
  • updated_at
    Timestamp of last farm update.

Relationships

  • grower
    Grower that this farm belongs to.
  • fields
    Fields that belong to this farm.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "100000",
      "type": "farms",
      "attributes": {
        "name": "Orange Farm",
        "description": "South of the river.",
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00"
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100001"
          }
        },
        "fields": {
          "links": {
            "related": "http://localhost:3000/api/fields?filter[farm_id]=100000"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/farms/100000"
      }
    },
    {
      "id": "100001",
      "type": "farms",
      "attributes": {
        "name": "Apple Farm",
        "description": "North of the river.",
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00"
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100001"
          }
        },
        "fields": {
          "links": {
            "related": "http://localhost:3000/api/fields?filter[farm_id]=100001"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/farms/100001"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/farms?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/farms?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/farms?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Fields

Fetch details for the specified field

Endpoint

GET /api/fields/:id

Parameters

  • required id
    Unique id of the field

Request

Route

GET /api/fields/100000

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique id of the field
  • name
    Name of the field.
  • description
    Description of the field.
  • irrigated
    True if this field is irrigated, false if not, null if unset.
  • created_at
    Timestamp of field creation.
  • updated_at
    Timestamp of last field update.

Relationships

  • grower
    Grower that this field belongs to.
  • farm
    Farm that the field belongs to.
  • field_boundaries
    Field boundaries that belong to this field.
  • field_crops
    Crops that belong to this field.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "100000",
    "type": "fields",
    "attributes": {
      "name": "Scarlet Navel",
      "description": "Field full of navel oranges.",
      "created_at": "2011-06-15T02:30:00+00:00",
      "updated_at": "2011-06-15T02:30:00+00:00",
      "irrigated": false
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/100001"
        }
      },
      "farm": {
        "links": {
          "related": "http://localhost:3000/api/farms/100000"
        }
      },
      "prescriptions": {
        "links": {
          "related": "http://localhost:3000/api/prescriptions?filter[field_id]=100000"
        }
      },
      "field_boundaries": {
        "links": {
          "related": "http://localhost:3000/api/field_boundaries?filter[field_id]=100000"
        }
      },
      "field_crops": {
        "links": {
          "related": "http://localhost:3000/api/field_crops?filter[field_id]=100000"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/fields/100000"
    }
  },
  "meta": {}
}

Fetch list of fields

Endpoint

GET /api/fields

Parameters

  • filter[name]
    Filter the result by the name or part of the name.
  • filter[grower_id]
    Filter results by one or more (comma-separated) grower ids.
  • filter[farm_id]
    Filter results by one or more (comma-separated) farm ids.
  • filter[updated_after]=yyyy-mm-ddThh:mm:ss+hh:mm
    Filter to farms that have had direct attributes updated after this time.

Request

Route

GET /api/fields

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique id of the field
  • name
    Name of the field.
  • description
    Description of the field.
  • irrigated
    True if this field is irrigated, false if not, null if unset.
  • created_at
    Timestamp of field creation.
  • updated_at
    Timestamp of last field update.

Relationships

  • grower
    Grower that this field belongs to.
  • farm
    Farm that the field belongs to.
  • field_boundaries
    Field boundaries that belong to this field.
  • field_crops
    Crops that belong to this field.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "100000",
      "type": "fields",
      "attributes": {
        "name": "Scarlet Navel",
        "description": "Field full of navel oranges.",
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "irrigated": false
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100001"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100000"
          }
        },
        "prescriptions": {
          "links": {
            "related": "http://localhost:3000/api/prescriptions?filter[field_id]=100000"
          }
        },
        "field_boundaries": {
          "links": {
            "related": "http://localhost:3000/api/field_boundaries?filter[field_id]=100000"
          }
        },
        "field_crops": {
          "links": {
            "related": "http://localhost:3000/api/field_crops?filter[field_id]=100000"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/fields/100000"
      }
    },
    {
      "id": "100001",
      "type": "fields",
      "attributes": {
        "name": "Tarocco",
        "description": "Field full of tarocco oranges.",
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "irrigated": true
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100001"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100000"
          }
        },
        "prescriptions": {
          "links": {
            "related": "http://localhost:3000/api/prescriptions?filter[field_id]=100001"
          }
        },
        "field_boundaries": {
          "links": {
            "related": "http://localhost:3000/api/field_boundaries?filter[field_id]=100001"
          }
        },
        "field_crops": {
          "links": {
            "related": "http://localhost:3000/api/field_crops?filter[field_id]=100001"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/fields/100001"
      }
    },
    {
      "id": "100002",
      "type": "fields",
      "attributes": {
        "name": "Pink Lady",
        "description": "Field full of pink ladies.",
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "irrigated": null
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100001"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100001"
          }
        },
        "prescriptions": {
          "links": {
            "related": "http://localhost:3000/api/prescriptions?filter[field_id]=100002"
          }
        },
        "field_boundaries": {
          "links": {
            "related": "http://localhost:3000/api/field_boundaries?filter[field_id]=100002"
          }
        },
        "field_crops": {
          "links": {
            "related": "http://localhost:3000/api/field_crops?filter[field_id]=100002"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/fields/100002"
      }
    },
    {
      "id": "100003",
      "type": "fields",
      "attributes": {
        "name": "Green Smith",
        "description": "Field full of green smiths.",
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "irrigated": false
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100001"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100001"
          }
        },
        "prescriptions": {
          "links": {
            "related": "http://localhost:3000/api/prescriptions?filter[field_id]=100003"
          }
        },
        "field_boundaries": {
          "links": {
            "related": "http://localhost:3000/api/field_boundaries?filter[field_id]=100003"
          }
        },
        "field_crops": {
          "links": {
            "related": "http://localhost:3000/api/field_crops?filter[field_id]=100003"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/fields/100003"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/fields?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/fields?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/fields?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Field Boundaries

Fetch details for the specified field boundary

Endpoint

GET /api/field_boundaries/:id

Parameters

  • required id
    Unique id of the field boundary.

Request

Route

GET /api/field_boundaries/100004

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique id of the field boundary.
  • from_date
    Date that this season begins.
  • to_date
    Date that this season ends.
  • production_year
    The assigned calendar year for this season.
  • updated_at
    Timestamp of last update.
  • area_scalar
    Area scalar of the field for this season.
  • area_units
    Area units of the field for this season.
  • boundary
    Boundary of the field for the provided season.

Relationships

  • field
    Field this boundary belongs to.
  • grower
    Grower this boundary belongs to.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "100004",
    "type": "field_boundaries",
    "attributes": {
      "area_scalar": 101.0,
      "area_units": "ha",
      "from_date": "2011-01-01",
      "to_date": "2011-12-31",
      "production_year": 2011,
      "boundary": {
        "type": "MultiPolygon",
        "coordinates": [
          [
            [
              [
                115.8336639404,
                -31.9507056964
              ],
              [
                115.8180427551,
                -31.964541909
              ],
              [
                115.8179569244,
                -31.9754637621
              ],
              [
                115.8237075805,
                -31.974517253
              ],
              [
                115.828256607,
                -31.972114532
              ],
              [
                115.831003189,
                -31.9720417213
              ],
              [
                115.833492279,
                -31.9716048558
              ],
              [
                115.8341789245,
                -31.9702214348
              ],
              [
                115.8395862579,
                -31.9661438621
              ],
              [
                115.8413028717,
                -31.9634496522
              ],
              [
                115.8463668823,
                -31.9615563763
              ],
              [
                115.8460235595,
                -31.958643568
              ],
              [
                115.8468818664,
                -31.9566045472
              ],
              [
                115.849199295,
                -31.9555850198
              ],
              [
                115.8477401733,
                -31.9527448481
              ],
              [
                115.8443069458,
                -31.9539828825
              ],
              [
                115.8336639404,
                -31.9507056964
              ]
            ]
          ]
        ]
      },
      "updated_at": "2011-06-15T02:51:48+00:00"
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/100001"
        }
      },
      "field": {
        "links": {
          "related": "http://localhost:3000/api/fields/100002"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/field_boundaries/100004"
    }
  },
  "meta": {}
}

Fetch list of field boundaries

Endpoint

GET /api/field_boundaries

Parameters

  • filter[active_before]=yyyy-mm-dd
    Filter to include the field boundaries that are active before this date.
  • filter[active_at]=yyyy-mm-dd
    Filter to include the field boundaries that are active on this date.
  • filter[active_after]=yyyy-mm-dd
    Filter to include the field boundaries that are active after this date.
  • filter[updated_after]=yyyy-mm-ddThh:mm:ss+hh:mm
    Filter to include the field boundaries that have been updated after this time.

Request

Route

GET /api/field_boundaries

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique id of the field boundary.
  • from_date
    Date that this season begins.
  • to_date
    Date that this season ends.
  • production_year
    The assigned calendar year for this season.
  • updated_at
    Timestamp of last update.
  • area_scalar
    Area scalar of the field for this season.
  • area_units
    Area units of the field for this season.
  • boundary
    Boundary of the field for the provided season.

Relationships

  • field
    Field this boundary belongs to.
  • grower
    Grower this boundary belongs to.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "100004",
      "type": "field_boundaries",
      "attributes": {
        "area_scalar": 101.0,
        "area_units": "ha",
        "from_date": "2011-01-01",
        "to_date": "2011-12-31",
        "production_year": 2011,
        "boundary": {
          "type": "MultiPolygon",
          "coordinates": [
            [
              [
                [
                  115.8336639404,
                  -31.9507056964
                ],
                [
                  115.8180427551,
                  -31.964541909
                ],
                [
                  115.8179569244,
                  -31.9754637621
                ],
                [
                  115.8237075805,
                  -31.974517253
                ],
                [
                  115.828256607,
                  -31.972114532
                ],
                [
                  115.831003189,
                  -31.9720417213
                ],
                [
                  115.833492279,
                  -31.9716048558
                ],
                [
                  115.8341789245,
                  -31.9702214348
                ],
                [
                  115.8395862579,
                  -31.9661438621
                ],
                [
                  115.8413028717,
                  -31.9634496522
                ],
                [
                  115.8463668823,
                  -31.9615563763
                ],
                [
                  115.8460235595,
                  -31.958643568
                ],
                [
                  115.8468818664,
                  -31.9566045472
                ],
                [
                  115.849199295,
                  -31.9555850198
                ],
                [
                  115.8477401733,
                  -31.9527448481
                ],
                [
                  115.8443069458,
                  -31.9539828825
                ],
                [
                  115.8336639404,
                  -31.9507056964
                ]
              ]
            ]
          ]
        },
        "updated_at": "2011-06-15T02:51:48+00:00"
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100001"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100002"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/field_boundaries/100004"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/field_boundaries?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/field_boundaries?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/field_boundaries?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Field Crops

Fetch details for the specified field crop

Endpoint

GET /api/field_crops/:id

Parameters

  • required id
    Unique Id of the field crop.

Request

Route

GET /api/field_crops/100009

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique Id of the field crop.
  • from_date
    Date that this season begins.
  • to_date
    Date that this season ends.
  • crop_name
    Name of the crop in the field for this season.
  • crop_use
    Use of the crop in the field for this season.
  • crop_blend
    Blend/Reason for this crop.
  • crop_technologies
    List of resistance traits for this crop.
  • area_scalar
    Area scalar of the field for this season.
  • area_units
    Area units of the field for this season.
  • harvested_weight_scalar
    Total harvested weight scalar for the field for this season.
  • harvested_weight_units
    Total harvested weight units for the field for this season.
  • harvest_date
    Timestamp for when the field has been harvested for this season.
  • planting_date
    Timestamp for when the field has been planted for this season.

Relationships

  • crop_variety
    Crop variety in the field for this season.
  • field
    Field this crop belongs to.
  • grower
    Grower this crop belongs to.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "100009",
    "type": "field_crops",
    "attributes": {
      "from_date": "2011-01-01T00:00:00+00:00",
      "to_date": "2011-12-31T00:00:00+00:00",
      "crop_name": "Wheat",
      "crop_use": "Feed",
      "crop_blend": "hybrid",
      "crop_technologies": [
        "Roundup Ready"
      ],
      "area_scalar": "10.0",
      "area_units": "ha",
      "harvested_weight_scalar": "0.227",
      "harvested_weight_units": "t",
      "harvest_date": "2011-06-15T02:30:00+00:00",
      "planting_date": "2011-02-28T16:00:00+00:00"
    },
    "relationships": {
      "field": {
        "links": {
          "related": "http://localhost:3000/api/fields/100002"
        }
      },
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/100001"
        }
      },
      "crop_variety": {
        "links": {
          "related": "http://localhost:3000/api/crop_varieties/CRP100006AU"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/field_crops/100009"
    }
  },
  "meta": {}
}

Fetch list of field crops

Endpoint

GET /api/field_crops

Parameters

  • filter[active_before]=yyyy-mm-dd
    Filter to include the field crops that are active before this date.
  • filter[active_at]=yyyy-mm-dd
    Filter to include the field crops that are active on this date.
  • filter[active_after]=yyyy-mm-dd
    Filter to include the field crops that are active after this date.

Request

Route

GET /api/field_crops

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique Id of the field crop.
  • from_date
    Date that this season begins.
  • to_date
    Date that this season ends.
  • crop_name
    Name of the crop in the field for this season.
  • crop_use
    Use of the crop in the field for this season.
  • crop_blend
    Blend/Reason for this crop.
  • crop_technologies
    List of resistance traits for this crop.
  • area_scalar
    Area scalar of the field for this season.
  • area_units
    Area units of the field for this season.
  • harvested_weight_scalar
    Total harvested weight scalar for the field for this season.
  • harvested_weight_units
    Total harvested weight units for the field for this season.
  • harvest_date
    Timestamp for when the field has been harvested for this season.
  • planting_date
    Timestamp for when the field has been planted for this season.

Relationships

  • crop_variety
    Crop variety in the field for this season.
  • field
    Field this crop belongs to.
  • grower
    Grower this crop belongs to.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "100009",
      "type": "field_crops",
      "attributes": {
        "from_date": "2011-01-01T00:00:00+00:00",
        "to_date": "2011-12-31T00:00:00+00:00",
        "crop_name": "Wheat",
        "crop_use": "Feed",
        "crop_blend": "hybrid",
        "crop_technologies": [
          "Roundup Ready"
        ],
        "area_scalar": "10.0",
        "area_units": "ha",
        "harvested_weight_scalar": "0.227",
        "harvested_weight_units": "t",
        "harvest_date": "2011-06-15T02:30:00+00:00",
        "planting_date": "2011-02-28T16:00:00+00:00"
      },
      "relationships": {
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100002"
          }
        },
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100001"
          }
        },
        "crop_variety": {
          "links": {
            "related": "http://localhost:3000/api/crop_varieties/CRP100006AU"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/field_crops/100009"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/field_crops?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/field_crops?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/field_crops?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Crop Varieties

Fetch details for the specified crop variety

Endpoint

GET /api/crop_varieties/:id

Parameters

  • required id
    Unique Id of the crop variety.

Request

Route

GET /api/crop_varieties/CRP100006AU

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique Id of the crop variety.
  • name
    Unique Id of the crop variety.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "CRP100006AU",
    "type": "crop_varieties",
    "attributes": {
      "name": "Saracen"
    },
    "links": {
      "self": "http://localhost:3000/api/crop_varieties/CRP100006AU"
    }
  },
  "meta": {}
}

Active Ingredient Amounts

Fetch applied active ingredients

Note: This is not a resourceful endpoint, therefore can’t be sideloaded or linked to other resources on this doc.

Endpoint

GET /api/growers/:grower_id/active_ingredient_amounts

Parameters

  • filter[completed_before]=yyyy-mm-dd
    Filter to include the active ingredients that were applied before this date.
  • filter[completed_after]=yyyy-mm-dd
    Filter to include the active ingredients that were applied on or after this date.
  • filter[farm_id]=id
    Filter to include the active ingredients that were applied on this farm.
  • filter[field_id]=id
    Filter to include the active ingredients that were applied on this field.

Request

Route

GET /api/growers/100001/active_ingredient_amounts

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • completed_at
    Date/time the application was made.
  • active_ingredient_name
    Name of the active ingredient.
  • field_id
    Field this application was made on. Is possible to be null.
  • application_boundary
    Boundary of field this application was made on.
  • total_weight_scalar
    Total scalar of the active ingredient applied.
  • total_weight_units
    Total units of the active ingredient applied.
  • application_area_scalar
    Application area scalar. This may be a subset/superset of the field's application boundary.
  • application_area_units
    Application area units.
  • applied_area_scalar
    Applied area scalar. This may be a subset of the application area, taking skip rows and spray band into account.
  • applied_area_units
    Applied area units.

Status

200

Headers

Content-Type: application/json; charset=utf-8

Body

[
  {
    "completed_at": "2011-06-15",
    "active_ingredient_name": "Nitrogen",
    "field_id": 100002,
    "application_boundary": {
      "type": "MultiPolygon",
      "coordinates": [
        [
          [
            [
              115.83366394,
              -31.950705696
            ],
            [
              115.818042755,
              -31.964541909
            ],
            [
              115.817956924,
              -31.975463762
            ],
            [
              115.823707581,
              -31.974517253
            ],
            [
              115.828256607,
              -31.972114532
            ],
            [
              115.831003189,
              -31.972041721
            ],
            [
              115.833492279,
              -31.971604856
            ],
            [
              115.834178925,
              -31.970221435
            ],
            [
              115.839586258,
              -31.966143862
            ],
            [
              115.841302872,
              -31.963449652
            ],
            [
              115.846366882,
              -31.961556376
            ],
            [
              115.84602356,
              -31.958643568
            ],
            [
              115.846881866,
              -31.956604547
            ],
            [
              115.849199295,
              -31.95558502
            ],
            [
              115.847740173,
              -31.952744848
            ],
            [
              115.844306946,
              -31.953982883
            ],
            [
              115.83366394,
              -31.950705696
            ]
          ]
        ]
      ]
    },
    "total_weight_scalar": 0.9375,
    "total_weight_units": "kg",
    "application_area_scalar": 50,
    "application_area_units": "ha",
    "applied_area_scalar": 12.5,
    "applied_area_units": "ha"
  }
]

Business Summaries

Note: Business Summary endpoints are only accessible to growers.

Data returned is from seasons in the last 4 years.

Fetch costs

A list of costs aggregated by grower, farm, field and several other attributes in CSV format.

Note: If your costs result set is large, data will be accurate to the last hour.

Endpoint

GET api/business_summaries/costs

Parameters

  • required api_token
    A valid api token to authenticate the user
  • cost_type
    What type of costs do you want to report on? Valid values are planned, forecast_remaining or actual. Default is actual.
  • date_grouping
    What level of grouping do you want to apply to the dates? Valid values are day, week, month or year. Default is year. (Dates returned will be the beginning of the date period, e.g. beginning of the week.)
  • units_of_measurement
    What units of measurement do you want to see your result in? Valid values are metric or imperial. Default is metric.

Request

Route

GET api/business_summaries/costs?api_token=secret&cost_type=actual&date_grouping=year&units_of_measurement=metric

Query Parameters

api_token=secret
cost_type=actual
date_grouping=year
units_of_measurement=metric

Response

Simulated Response

Response Fields

  • grower_id
    Id of the grower company.
  • grower_name
    Name of the grower company.
  • production_year
    Assigned calendar year of the season.
  • season_name
    Name of the season.
  • farm_id
    Id of the farm.
  • farm_name
    Name of the farm.
  • field_id
    Id of the field.
  • field_name
    Name of the field.
  • crop_name
    Name of the crop.
  • variety_name
    Name of the crop variety.
  • strategy_name
    Name of the strategy.
  • type
    Type of the cost. Will be either fixed or variable.
  • category
    Category of the cost. Will be one of chemical, fertilizer, seed or operation for variable costs.
  • subcategory
    Sub-category of the cost. Contains finer detail than the category.
  • name
    Name of the input/cost.
  • input_id
    ID for the input/cost.
  • date
    Date of the application. Date completed for actuals, date due for others.
  • total_cost
    Total cost.
  • input_volume_scalar
    Total input volume scalar.
  • input_volume_units
    Total input volume unit.
  • input_weight_scalar
    Total input weight scalar.
  • input_weight_units
    Total input weight unit.
  • input_count
    Total input count.
  • input_hours
    Total input hours.
  • input_area_scalar
    Total input area scalar.
  • input_area_units
    Total input area unit.

Status

200

Headers

Content-Type: text/csv

Fetch field crop areas

A list of areas aggregated by grower, farm, field, season and crop in CSV format

Endpoint

GET api/business_summaries/field_crop_areas

Parameters

  • required api_token
    A valid api token to authenticate the user
  • units_of_measurement
    What units of measurement do you want to see your result in? Valid values are metric or imperial. Default is metric.

Request

Route

GET api/business_summaries/field_crop_areas?api_token=secret&units_of_measurement=metric

Query Parameters

api_token=secret
units_of_measurement=metric

Response

Simulated Response

Response Fields

  • grower_id
    Id of the grower company.
  • grower_name
    Name of the grower company.
  • production_year
    Assigned calendar year of the season.
  • season_name
    Name of the season.
  • farm_id
    Id of the farm.
  • farm_name
    Name of the farm.
  • field_id
    Id of the field.
  • field_name
    Name of the field.
  • crop_name
    Name of the crop.
  • variety_name
    Name of the crop variety.
  • strategy_name
    Name of the strategy.
  • field_crop_area_scalar
    Total area scalar of the crop in this field.
  • field_crop_area_units
    Total area units of the crop in this field.

Status

200

Headers

Content-Type: text/csv

Fetch revenues

A list of revenue aggregated by grower, farm, field and several other attributes in CSV format

Endpoint

GET api/business_summaries/revenues

Parameters

  • required api_token
    A valid api token to authenticate the user
  • revenue_type
    What type of revenue do you want to report on? Valid values are planned, or actual. Default is actual.
  • units_of_measurement
    What units of measurement do you want to see your result in? Valid values are metric or imperial. Default is metric.
  • use_crop_specific_masses
    Some crops have specific mass units such as "bushel" (bu) for Corn and Soy, and "bale" for Cotton. We will use these units by default. Set to false if you want everything in either metric or imperial, depending on the units_of_measurement parameter.

Request

Route

GET api/business_summaries/revenues?api_token=secret&revenue_type=actual&units_of_measurement=metric&use_crop_specific_masses=false

Query Parameters

api_token=secret
revenue_type=actual
units_of_measurement=metric
use_crop_specific_masses=false

Response

Simulated Response

Response Fields

  • grower_id
    Id of the grower company.
  • grower_name
    Name of the grower company.
  • production_year
    Assigned calendar year of the season.
  • season_name
    Name of the season.
  • farm_id
    Id of the farm.
  • farm_name
    Name of the farm.
  • field_id
    Id of the field.
  • field_name
    Name of the field.
  • crop_name
    Name of the crop.
  • variety_name
    Name of the crop variety.
  • strategy_name
    Name of the strategy.
  • price_scalar
    Price scalar (actual by default).
  • price_units
    Price units (actual by default).
  • harvest_weight_scalar
    Harvested weight scalar (actual by default).
  • harvest_weight_units
    Harvested weight units (actual by default).
  • crop_revenue
    Revenue from harvested crops (actual by default).
  • other_revenue
    Other revenue (actual by default).

Status

200

Headers

Content-Type: text/csv

Frames

Creates a new frame

Endpoint

POST /api/frames

Parameters

Relationships

  • required data.relationships.grower.data. id
    Grower id.
    integer
  • required data.relationships.grower.data. type
    Should always be 'growers'.
    string

Request

Route

POST /api/frames

Headers

Authorization: Bearer <token>
Content-Type: application/vnd.api+json

Body

{
  "data": {
    "type": "frames",
    "attributes": {
      "name": "An Agworld Frame",
      "icon": "iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAIAAAAABMCaAAABhWlDQ1BJQ0Mg\ncHJvZmlsZQAAKJF9kT1Iw1AUhU9TtaIVBzuIOGSoThZFRRy1CkWoEGqFVh1M\nXvojNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEzc1J0UVKvC8ptIjxweV9nPfO\n4b77AKFWYprVNgZoum2mEnExk10RQ68IoYOqG6Mys4xZSUrCd33dI8D3uxjP\n8r/35+pRcxYDAiLxDDNMm3ideGrTNjjvE0dYUVaJz4lHTGqQ+JHrisdvnAsu\nCzwzYqZTc8QRYrHQwkoLs6KpEU8SR1VNp3wh47HKeYuzVqqwRp/8heGcvrzE\ndapBJLCARUgQoaCCDZRgI0a7ToqFFJ3HffwDrl8il0KuDTByzKMMDbLrB/+D\n37O18hPjXlI4DrS/OM7HEBDaBepVx/k+dpz6CRB8Bq70pr9cA6Y/Sa82tegR\n0LsNXFw3NWUPuNwB+p8M2ZRdKUgl5PPA+xl9UxbouwW6Vr25Nc5x+gCkaVbJ\nG+DgEBguUPaaz7s7W+f2753G/H4AL0pyjHg9Kd4AAAAJcEhZcwAALiMAAC4j\nAXilP3YAAAAHdElNRQflBwYHEREhMLY6AAAAGXRFWHRDb21tZW50AENyZWF0\nZWQgd2l0aCBHSU1QV4EOFwAAAJ1JREFUeNrt0DERAAAIBCC1f+c3hJsHEegk\nxc0okChRIhIlSpSIRIkSJSJRokSJSJQoUSISJUqUiESJEpEoUaJEJEqUKBGJ\nEiVKRKJEiRKRKFGiRCRKlCgRiRIlIlGiRIlIlChRIhIlSpSIRIkSJSJRokSJ\nSJQoUSISJUpEokSJEpEoUaJEJEqUKBGJEiVKRKJEiRKRKFEiEiVK/GMBLwoD\n1VRze2wAAAAASUVORK5CYII=\n",
      "type": "Agworld frame type",
      "metadata": {
        "key": "test value"
      },
      "contexts": [
        {
          "type": "location",
          "lat": 31.9523,
          "lng": 115.8613
        },
        {
          "type": "field_crop",
          "field_crop_id": 64738,
          "scope": "agronomic_snapshot"
        }
      ],
      "content": [
        {
          "type": "text",
          "text": "Hello World"
        },
        {
          "type": "data_table",
          "table_style": "expanded",
          "items": [
            {
              "field": "Key",
              "value": "Value 1",
              "accent": "green",
              "icon": "caret_up"
            },
            {
              "field": "Key",
              "value": "Value 2"
            },
            {
              "field": "Key",
              "value": "Value 3 which is a very long value that will exhibit different behaviours to the other values"
            }
          ]
        }
      ]
    },
    "relationships": {
      "grower": {
        "data": {
          "type": "growers",
          "id": 53280
        }
      }
    }
  }
}

Response

Simulated Response

Response Fields

  • id
    Unique id of the frame.
  • name
    The display name of the frame, should be a string of maximum 28 characters.
  • icon
    The display icon of the frame. Must be a 108px x 108px PNG image encoded in Base64.
  • metadata
    A hash of provider defined key-value data.
  • contexts
    An array of context objects that describe when the frame will be displayed.
  • content
    An array of content objects that describes contents of the frame.
  • provider_name
    The name of the provider that created this frame.
  • created_at
    The date and time that the frame was created.
  • updated_at
    The date and time that the frame was last updated.
  • type
    The type of this frame, should be a string of maximum 28 characters.
  • data.attributes. name
    The display name of the frame, should be a string of maximum 28 characters.
    string
  • data.attributes. icon
    The display icon of the frame. Must be a 108px x 108px PNG image encoded in Base64.
    string
  • data.attributes. type
    The type of this frame, should be a string of maximum 28 characters.
    string
  • data.attributes. metadata
    A hash of provider defined key-value data.
    json
  • data.attributes. contexts
    An array of context objects that describe when the frame will be displayed.
    json
  • data.attributes. content
    An array of content objects that describes contents of the frame.
    json

Relationships

  • grower
    grower

Status

201

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "29041",
    "type": "frames",
    "attributes": {
      "name": "An Agworld Frame",
      "metadata": {
        "key": "test value"
      },
      "type": "Agworld frame type",
      "icon": "iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAIAAAAABMCaAAABhWlDQ1BJQ0Mg\ncHJvZmlsZQAAKJF9kT1Iw1AUhU9TtaIVBzuIOGSoThZFRRy1CkWoEGqFVh1M\nXvojNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEzc1J0UVKvC8ptIjxweV9nPfO\n4b77AKFWYprVNgZoum2mEnExk10RQ68IoYOqG6Mys4xZSUrCd33dI8D3uxjP\n8r/35+pRcxYDAiLxDDNMm3ideGrTNjjvE0dYUVaJz4lHTGqQ+JHrisdvnAsu\nCzwzYqZTc8QRYrHQwkoLs6KpEU8SR1VNp3wh47HKeYuzVqqwRp/8heGcvrzE\ndapBJLCARUgQoaCCDZRgI0a7ToqFFJ3HffwDrl8il0KuDTByzKMMDbLrB/+D\n37O18hPjXlI4DrS/OM7HEBDaBepVx/k+dpz6CRB8Bq70pr9cA6Y/Sa82tegR\n0LsNXFw3NWUPuNwB+p8M2ZRdKUgl5PPA+xl9UxbouwW6Vr25Nc5x+gCkaVbJ\nG+DgEBguUPaaz7s7W+f2753G/H4AL0pyjHg9Kd4AAAAJcEhZcwAALiMAAC4j\nAXilP3YAAAAHdElNRQflBwYHEREhMLY6AAAAGXRFWHRDb21tZW50AENyZWF0\nZWQgd2l0aCBHSU1QV4EOFwAAAJ1JREFUeNrt0DERAAAIBCC1f+c3hJsHEegk\nxc0okChRIhIlSpSIRIkSJSJRokSJSJQoUSISJUqUiESJEpEoUaJEJEqUKBGJ\nEiVKRKJEiRKRKFGiRCRKlCgRiRIlIlGiRIlIlChRIhIlSpSIRIkSJSJRokSJ\nSJQoUSISJUpEokSJEpEoUaJEJEqUKBGJEiVKRKJEiRKRKFEiEiVK/GMBLwoD\n1VRze2wAAAAASUVORK5CYII=\n",
      "provider_name": "Example provider",
      "content": [
        {
          "text": "Hello World",
          "align": "left",
          "style": "paragraph",
          "type": "text"
        },
        {
          "table_style": "expanded",
          "items": [
            {
              "field": "Key",
              "value": "Value 1",
              "accent": "green",
              "icon": "caret_up"
            },
            {
              "field": "Key",
              "value": "Value 2"
            },
            {
              "field": "Key",
              "value": "Value 3 which is a very long value that will exhibit different behaviours to the other values"
            }
          ],
          "type": "data_table"
        }
      ],
      "contexts": [
        {
          "type": "location",
          "lat": 31.9523,
          "lng": 115.8613
        },
        {
          "type": "field_crop",
          "field_crop_id": 64738,
          "scope": "agronomic_snapshot"
        }
      ],
      "created_at": "2011-06-15T02:30:00+00:00",
      "updated_at": "2011-06-15T02:30:00+00:00"
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/53280"
        },
        "data": {
          "type": "growers",
          "id": "53280"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/frames/29041"
    }
  },
  "included": [
    {
      "id": "53280",
      "type": "growers",
      "attributes": {
        "name": "Brannoch Holdings",
        "description": null,
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "business_identifier": null,
        "organisation_id": "53280"
      },
      "relationships": {
        "fields": {
          "links": {
            "related": "http://localhost:3000/api/fields?filter[grower_id]=53280"
          }
        },
        "field_crops": {
          "links": {
            "related": "http://localhost:3000/api/field_crops?filter[grower_id]=53280"
          }
        },
        "farms": {
          "links": {
            "related": "http://localhost:3000/api/farms?filter[grower_id]=53280"
          }
        },
        "prescriptions": {
          "links": {
            "related": "http://localhost:3000/api/prescriptions?filter[grower_id]=53280"
          }
        },
        "field_boundaries": {
          "links": {
            "related": "http://localhost:3000/api/field_boundaries?filter[grower_id]=53280"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/growers/53280"
      }
    }
  ],
  "meta": {}
}

Delete a frame

Endpoint

DELETE /api/frames/:id

Parameters

  • required id
    Unique id of the frame.

Request

Route

DELETE /api/frames/29020

Headers

Authorization: Bearer <token>
Content-Type: application/x-www-form-urlencoded

Response

Simulated Response

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "29020",
    "type": "frames",
    "attributes": {
      "name": "Test Frame 8",
      "metadata": {
        "key1": "value1",
        "key2": "value2"
      },
      "type": null,
      "icon": "iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAIAAAAABMCaAAABhWlDQ1BJQ0Mg\ncHJvZmlsZQAAKJF9kT1Iw1AUhU9TtaIVBzuIOGSoThZFRRy1CkWoEGqFVh1M\nXvojNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEzc1J0UVKvC8ptIjxweV9nPfO\n4b77AKFWYprVNgZoum2mEnExk10RQ68IoYOqG6Mys4xZSUrCd33dI8D3uxjP\n8r/35+pRcxYDAiLxDDNMm3ideGrTNjjvE0dYUVaJz4lHTGqQ+JHrisdvnAsu\nCzwzYqZTc8QRYrHQwkoLs6KpEU8SR1VNp3wh47HKeYuzVqqwRp/8heGcvrzE\ndapBJLCARUgQoaCCDZRgI0a7ToqFFJ3HffwDrl8il0KuDTByzKMMDbLrB/+D\n37O18hPjXlI4DrS/OM7HEBDaBepVx/k+dpz6CRB8Bq70pr9cA6Y/Sa82tegR\n0LsNXFw3NWUPuNwB+p8M2ZRdKUgl5PPA+xl9UxbouwW6Vr25Nc5x+gCkaVbJ\nG+DgEBguUPaaz7s7W+f2753G/H4AL0pyjHg9Kd4AAAAJcEhZcwAALiMAAC4j\nAXilP3YAAAAHdElNRQflBwYHEREhMLY6AAAAGXRFWHRDb21tZW50AENyZWF0\nZWQgd2l0aCBHSU1QV4EOFwAAAJ1JREFUeNrt0DERAAAIBCC1f+c3hJsHEegk\nxc0okChRIhIlSpSIRIkSJSJRokSJSJQoUSISJUqUiESJEpEoUaJEJEqUKBGJ\nEiVKRKJEiRKRKFGiRCRKlCgRiRIlIlGiRIlIlChRIhIlSpSIRIkSJSJRokSJ\nSJQoUSISJUpEokSJEpEoUaJEJEqUKBGJEiVKRKJEiRKRKFEiEiVK/GMBLwoD\n1VRze2wAAAAASUVORK5CYII=\n",
      "provider_name": "Example provider",
      "content": [
        {
          "text": "test",
          "align": "left",
          "style": "paragraph",
          "type": "text"
        }
      ],
      "contexts": [],
      "created_at": "2011-06-15T02:30:00+00:00",
      "updated_at": "2011-06-15T02:30:00+00:00"
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/53280"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/frames/29020"
    }
  },
  "meta": {}
}

Fetch a frame

Endpoint

GET /api/frames/:id

Parameters

  • required id
    Unique id of the frame.

Request

Route

GET /api/frames/29020

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique id of the frame.
  • name
    The display name of the frame, should be a string of maximum 28 characters.
  • icon
    The display icon of the frame. Must be a 108px x 108px PNG image encoded in Base64.
  • metadata
    A hash of provider defined key-value data.
  • contexts
    An array of context objects that describe when the frame will be displayed.
  • content
    An array of content objects that describes contents of the frame.
  • provider_name
    The name of the provider that created this frame.
  • created_at
    The date and time that the frame was created.
  • updated_at
    The date and time that the frame was last updated.
  • type
    The type of this frame, should be a string of maximum 28 characters.

Relationships

  • grower
    grower

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "29020",
    "type": "frames",
    "attributes": {
      "name": "Test Frame 6",
      "metadata": {
        "key1": "value1",
        "key2": "value2"
      },
      "type": null,
      "icon": "iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAIAAAAABMCaAAABhWlDQ1BJQ0Mg\ncHJvZmlsZQAAKJF9kT1Iw1AUhU9TtaIVBzuIOGSoThZFRRy1CkWoEGqFVh1M\nXvojNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEzc1J0UVKvC8ptIjxweV9nPfO\n4b77AKFWYprVNgZoum2mEnExk10RQ68IoYOqG6Mys4xZSUrCd33dI8D3uxjP\n8r/35+pRcxYDAiLxDDNMm3ideGrTNjjvE0dYUVaJz4lHTGqQ+JHrisdvnAsu\nCzwzYqZTc8QRYrHQwkoLs6KpEU8SR1VNp3wh47HKeYuzVqqwRp/8heGcvrzE\ndapBJLCARUgQoaCCDZRgI0a7ToqFFJ3HffwDrl8il0KuDTByzKMMDbLrB/+D\n37O18hPjXlI4DrS/OM7HEBDaBepVx/k+dpz6CRB8Bq70pr9cA6Y/Sa82tegR\n0LsNXFw3NWUPuNwB+p8M2ZRdKUgl5PPA+xl9UxbouwW6Vr25Nc5x+gCkaVbJ\nG+DgEBguUPaaz7s7W+f2753G/H4AL0pyjHg9Kd4AAAAJcEhZcwAALiMAAC4j\nAXilP3YAAAAHdElNRQflBwYHEREhMLY6AAAAGXRFWHRDb21tZW50AENyZWF0\nZWQgd2l0aCBHSU1QV4EOFwAAAJ1JREFUeNrt0DERAAAIBCC1f+c3hJsHEegk\nxc0okChRIhIlSpSIRIkSJSJRokSJSJQoUSISJUqUiESJEpEoUaJEJEqUKBGJ\nEiVKRKJEiRKRKFGiRCRKlCgRiRIlIlGiRIlIlChRIhIlSpSIRIkSJSJRokSJ\nSJQoUSISJUpEokSJEpEoUaJEJEqUKBGJEiVKRKJEiRKRKFEiEiVK/GMBLwoD\n1VRze2wAAAAASUVORK5CYII=\n",
      "provider_name": "Example provider",
      "content": [
        {
          "text": "test",
          "align": "left",
          "style": "paragraph",
          "type": "text"
        }
      ],
      "contexts": [
        {
          "type": "location",
          "lat": 30.0,
          "lng": 100.0
        }
      ],
      "created_at": "2011-06-15T02:30:00+00:00",
      "updated_at": "2011-06-15T02:30:00+00:00"
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/53280"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/frames/29020"
    }
  },
  "meta": {}
}

Fetch frames with filter by grower_id

Endpoint

GET /api/frames

Parameters

  • filter[grower_id]
    Filter results by one or more (comma-separated) grower ids.

Request

Route

GET /api/frames?filter[grower_id]=53280

Headers

Authorization: Bearer <token>

Query Parameters

filter={"grower_id"=>"53280"}

Response

Simulated Response

Response Fields

  • id
    Unique id of the frame.
  • name
    The display name of the frame, should be a string of maximum 28 characters.
  • icon
    The display icon of the frame. Must be a 108px x 108px PNG image encoded in Base64.
  • metadata
    A hash of provider defined key-value data.
  • contexts
    An array of context objects that describe when the frame will be displayed.
  • content
    An array of content objects that describes contents of the frame.
  • provider_name
    The name of the provider that created this frame.
  • created_at
    The date and time that the frame was created.
  • updated_at
    The date and time that the frame was last updated.
  • type
    The type of this frame, should be a string of maximum 28 characters.

Relationships

  • grower
    grower

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "2",
      "type": "frames",
      "attributes": {
        "name": "Test Frame 3",
        "metadata": {
          "key1": "value1",
          "key2": "value2"
        },
        "type": null,
        "icon": "iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAIAAAAABMCaAAABhWlDQ1BJQ0Mg\ncHJvZmlsZQAAKJF9kT1Iw1AUhU9TtaIVBzuIOGSoThZFRRy1CkWoEGqFVh1M\nXvojNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEzc1J0UVKvC8ptIjxweV9nPfO\n4b77AKFWYprVNgZoum2mEnExk10RQ68IoYOqG6Mys4xZSUrCd33dI8D3uxjP\n8r/35+pRcxYDAiLxDDNMm3ideGrTNjjvE0dYUVaJz4lHTGqQ+JHrisdvnAsu\nCzwzYqZTc8QRYrHQwkoLs6KpEU8SR1VNp3wh47HKeYuzVqqwRp/8heGcvrzE\ndapBJLCARUgQoaCCDZRgI0a7ToqFFJ3HffwDrl8il0KuDTByzKMMDbLrB/+D\n37O18hPjXlI4DrS/OM7HEBDaBepVx/k+dpz6CRB8Bq70pr9cA6Y/Sa82tegR\n0LsNXFw3NWUPuNwB+p8M2ZRdKUgl5PPA+xl9UxbouwW6Vr25Nc5x+gCkaVbJ\nG+DgEBguUPaaz7s7W+f2753G/H4AL0pyjHg9Kd4AAAAJcEhZcwAALiMAAC4j\nAXilP3YAAAAHdElNRQflBwYHEREhMLY6AAAAGXRFWHRDb21tZW50AENyZWF0\nZWQgd2l0aCBHSU1QV4EOFwAAAJ1JREFUeNrt0DERAAAIBCC1f+c3hJsHEegk\nxc0okChRIhIlSpSIRIkSJSJRokSJSJQoUSISJUqUiESJEpEoUaJEJEqUKBGJ\nEiVKRKJEiRKRKFGiRCRKlCgRiRIlIlGiRIlIlChRIhIlSpSIRIkSJSJRokSJ\nSJQoUSISJUpEokSJEpEoUaJEJEqUKBGJEiVKRKJEiRKRKFEiEiVK/GMBLwoD\n1VRze2wAAAAASUVORK5CYII=\n",
        "provider_name": "Example provider",
        "content": [
          {
            "text": "test",
            "align": "left",
            "style": "paragraph",
            "type": "text"
          }
        ],
        "contexts": [
          {
            "type": "location",
            "lat": 30.0,
            "lng": 100.0
          }
        ],
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00"
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/53280"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/frames/2"
      }
    },
    {
      "id": "29020",
      "type": "frames",
      "attributes": {
        "name": "Test Frame 4",
        "metadata": {
          "key1": "value1",
          "key2": "value2"
        },
        "type": null,
        "icon": "iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAIAAAAABMCaAAABhWlDQ1BJQ0Mg\ncHJvZmlsZQAAKJF9kT1Iw1AUhU9TtaIVBzuIOGSoThZFRRy1CkWoEGqFVh1M\nXvojNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEzc1J0UVKvC8ptIjxweV9nPfO\n4b77AKFWYprVNgZoum2mEnExk10RQ68IoYOqG6Mys4xZSUrCd33dI8D3uxjP\n8r/35+pRcxYDAiLxDDNMm3ideGrTNjjvE0dYUVaJz4lHTGqQ+JHrisdvnAsu\nCzwzYqZTc8QRYrHQwkoLs6KpEU8SR1VNp3wh47HKeYuzVqqwRp/8heGcvrzE\ndapBJLCARUgQoaCCDZRgI0a7ToqFFJ3HffwDrl8il0KuDTByzKMMDbLrB/+D\n37O18hPjXlI4DrS/OM7HEBDaBepVx/k+dpz6CRB8Bq70pr9cA6Y/Sa82tegR\n0LsNXFw3NWUPuNwB+p8M2ZRdKUgl5PPA+xl9UxbouwW6Vr25Nc5x+gCkaVbJ\nG+DgEBguUPaaz7s7W+f2753G/H4AL0pyjHg9Kd4AAAAJcEhZcwAALiMAAC4j\nAXilP3YAAAAHdElNRQflBwYHEREhMLY6AAAAGXRFWHRDb21tZW50AENyZWF0\nZWQgd2l0aCBHSU1QV4EOFwAAAJ1JREFUeNrt0DERAAAIBCC1f+c3hJsHEegk\nxc0okChRIhIlSpSIRIkSJSJRokSJSJQoUSISJUqUiESJEpEoUaJEJEqUKBGJ\nEiVKRKJEiRKRKFGiRCRKlCgRiRIlIlGiRIlIlChRIhIlSpSIRIkSJSJRokSJ\nSJQoUSISJUpEokSJEpEoUaJEJEqUKBGJEiVKRKJEiRKRKFEiEiVK/GMBLwoD\n1VRze2wAAAAASUVORK5CYII=\n",
        "provider_name": "Example provider",
        "content": [
          {
            "text": "test",
            "align": "left",
            "style": "paragraph",
            "type": "text"
          }
        ],
        "contexts": [
          {
            "type": "location",
            "lat": 30.0,
            "lng": 100.0
          }
        ],
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00"
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/53280"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/frames/29020"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/frames?filter%5Bgrower_id%5D=53280&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/frames?filter%5Bgrower_id%5D=53280&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/frames?filter%5Bgrower_id%5D=53280&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Fetch list of frames

Endpoint

GET /api/frames

Request

Route

GET /api/frames

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • id
    Unique id of the frame.
  • name
    The display name of the frame, should be a string of maximum 28 characters.
  • icon
    The display icon of the frame. Must be a 108px x 108px PNG image encoded in Base64.
  • metadata
    A hash of provider defined key-value data.
  • contexts
    An array of context objects that describe when the frame will be displayed.
  • content
    An array of content objects that describes contents of the frame.
  • provider_name
    The name of the provider that created this frame.
  • created_at
    The date and time that the frame was created.
  • updated_at
    The date and time that the frame was last updated.
  • type
    The type of this frame, should be a string of maximum 28 characters.

Relationships

  • grower
    grower

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "29020",
      "type": "frames",
      "attributes": {
        "name": "Test Frame 1",
        "metadata": {
          "key1": "value1",
          "key2": "value2"
        },
        "type": null,
        "icon": "iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAIAAAAABMCaAAABhWlDQ1BJQ0Mg\ncHJvZmlsZQAAKJF9kT1Iw1AUhU9TtaIVBzuIOGSoThZFRRy1CkWoEGqFVh1M\nXvojNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEzc1J0UVKvC8ptIjxweV9nPfO\n4b77AKFWYprVNgZoum2mEnExk10RQ68IoYOqG6Mys4xZSUrCd33dI8D3uxjP\n8r/35+pRcxYDAiLxDDNMm3ideGrTNjjvE0dYUVaJz4lHTGqQ+JHrisdvnAsu\nCzwzYqZTc8QRYrHQwkoLs6KpEU8SR1VNp3wh47HKeYuzVqqwRp/8heGcvrzE\ndapBJLCARUgQoaCCDZRgI0a7ToqFFJ3HffwDrl8il0KuDTByzKMMDbLrB/+D\n37O18hPjXlI4DrS/OM7HEBDaBepVx/k+dpz6CRB8Bq70pr9cA6Y/Sa82tegR\n0LsNXFw3NWUPuNwB+p8M2ZRdKUgl5PPA+xl9UxbouwW6Vr25Nc5x+gCkaVbJ\nG+DgEBguUPaaz7s7W+f2753G/H4AL0pyjHg9Kd4AAAAJcEhZcwAALiMAAC4j\nAXilP3YAAAAHdElNRQflBwYHEREhMLY6AAAAGXRFWHRDb21tZW50AENyZWF0\nZWQgd2l0aCBHSU1QV4EOFwAAAJ1JREFUeNrt0DERAAAIBCC1f+c3hJsHEegk\nxc0okChRIhIlSpSIRIkSJSJRokSJSJQoUSISJUqUiESJEpEoUaJEJEqUKBGJ\nEiVKRKJEiRKRKFGiRCRKlCgRiRIlIlGiRIlIlChRIhIlSpSIRIkSJSJRokSJ\nSJQoUSISJUpEokSJEpEoUaJEJEqUKBGJEiVKRKJEiRKRKFEiEiVK/GMBLwoD\n1VRze2wAAAAASUVORK5CYII=\n",
        "provider_name": "Example provider",
        "content": [
          {
            "text": "test",
            "align": "left",
            "style": "paragraph",
            "type": "text"
          }
        ],
        "contexts": [
          {
            "type": "location",
            "lat": 30.0,
            "lng": 100.0
          }
        ],
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00"
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/53280"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/frames/29020"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/frames?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/frames?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/frames?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Update a frame

Note: Frames can only be modified using the application that created them.

Endpoint

PATCH /api/frames/:id

Parameters

  • required data. id
    Unique id of the frame.
  • required data. type
    Should always be 'frames'.
    string

Request

Route

PATCH /api/frames/29020

Headers

Authorization: Bearer <token>
Content-Type: application/vnd.api+json

Body

{
  "data": {
    "type": "frames",
    "id": 29020,
    "attributes": {
      "name": "Updated Agworld frame",
      "metadata": {
        "key": "Updated value"
      },
      "icon": "iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAIAAAAABMCaAAABhWlDQ1BJQ0Mg\ncHJvZmlsZQAAKJF9kT1Iw1AUhU9TtaIVBzuIOGSoThZFRRy1CkWoEGqFVh1M\nXvojNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEzc1J0UVKvC8ptIjxweV9nPfO\n4b77AKFWYprVNgZoum2mEnExk10RQ68IoYOqG6Mys4xZSUrCd33dI8D3uxjP\n8r/35+pRcxYDAiLxDDNMm3ideGrTNjjvE0dYUVaJz4lHTGqQ+JHrisdvnAsu\nCzwzYqZTc8QRYrHQwkoLs6KpEU8SR1VNp3wh47HKeYuzVqqwRp/8heGcvrzE\ndapBJLCARUgQoaCCDZRgI0a7ToqFFJ3HffwDrl8il0KuDTByzKMMDbLrB/+D\n37O18hPjXlI4DrS/OM7HEBDaBepVx/k+dpz6CRB8Bq70pr9cA6Y/Sa82tegR\n0LsNXFw3NWUPuNwB+p8M2ZRdKUgl5PPA+xl9UxbouwW6Vr25Nc5x+gCkaVbJ\nG+DgEBguUPaaz7s7W+f2753G/H4AL0pyjHg9Kd4AAAAJcEhZcwAALiMAAC4j\nAXilP3YAAAAHdElNRQflBwYHEREhMLY6AAAAGXRFWHRDb21tZW50AENyZWF0\nZWQgd2l0aCBHSU1QV4EOFwAAAJ1JREFUeNrt0DERAAAIBCC1f+c3hJsHEegk\nxc0okChRIhIlSpSIRIkSJSJRokSJSJQoUSISJUqUiESJEpEoUaJEJEqUKBGJ\nEiVKRKJEiRKRKFGiRCRKlCgRiRIlIlGiRIlIlChRIhIlSpSIRIkSJSJRokSJ\nSJQoUSISJUpEokSJEpEoUaJEJEqUKBGJEiVKRKJEiRKRKFEiEiVK/GMBLwoD\n1VRze2wAAAAASUVORK5CYII=\n",
      "type": "Updated Agworld frame type",
      "contexts": [
        {
          "type": "location",
          "lat": 30.0,
          "lng": 110.0
        },
        {
          "type": "field_crop",
          "field_crop_id": 64738,
          "scope": "financial_snapshot"
        }
      ],
      "content": [
        {
          "type": "text",
          "text": "Updated World"
        },
        {
          "type": "data_table",
          "table_style": "truncated",
          "items": [
            {
              "field": "Key",
              "value": "Value 1"
            }
          ]
        }
      ]
    }
  }
}

Response

Simulated Response

Response Fields

  • id
    Unique id of the frame.
  • name
    The display name of the frame, should be a string of maximum 28 characters.
  • icon
    The display icon of the frame. Must be a 108px x 108px PNG image encoded in Base64.
  • metadata
    A hash of provider defined key-value data.
  • contexts
    An array of context objects that describe when the frame will be displayed.
  • content
    An array of content objects that describes contents of the frame.
  • provider_name
    The name of the provider that created this frame.
  • created_at
    The date and time that the frame was created.
  • updated_at
    The date and time that the frame was last updated.
  • type
    The type of this frame, should be a string of maximum 28 characters.
  • data.attributes. name
    The display name of the frame, should be a string of maximum 28 characters.
    string
  • data.attributes. icon
    The display icon of the frame. Must be a 108px x 108px PNG image encoded in Base64.
    string
  • data.attributes. type
    The type of this frame, should be a string of maximum 28 characters.
    string
  • data.attributes. metadata
    A hash of provider defined key-value data.
    json
  • data.attributes. contexts
    An array of context objects that describe when the frame will be displayed.
    json
  • data.attributes. content
    An array of content objects that describes contents of the frame.
    json

Relationships

  • grower
    grower

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "29020",
    "type": "frames",
    "attributes": {
      "name": "Updated Agworld frame",
      "metadata": {
        "key": "Updated value"
      },
      "type": "Updated Agworld frame type",
      "icon": "iVBORw0KGgoAAAANSUhEUgAAAGwAAABsCAIAAAAABMCaAAABhWlDQ1BJQ0Mg\ncHJvZmlsZQAAKJF9kT1Iw1AUhU9TtaIVBzuIOGSoThZFRRy1CkWoEGqFVh1M\nXvojNGlIUlwcBdeCgz+LVQcXZ10dXAVB8AfEzc1J0UVKvC8ptIjxweV9nPfO\n4b77AKFWYprVNgZoum2mEnExk10RQ68IoYOqG6Mys4xZSUrCd33dI8D3uxjP\n8r/35+pRcxYDAiLxDDNMm3ideGrTNjjvE0dYUVaJz4lHTGqQ+JHrisdvnAsu\nCzwzYqZTc8QRYrHQwkoLs6KpEU8SR1VNp3wh47HKeYuzVqqwRp/8heGcvrzE\ndapBJLCARUgQoaCCDZRgI0a7ToqFFJ3HffwDrl8il0KuDTByzKMMDbLrB/+D\n37O18hPjXlI4DrS/OM7HEBDaBepVx/k+dpz6CRB8Bq70pr9cA6Y/Sa82tegR\n0LsNXFw3NWUPuNwB+p8M2ZRdKUgl5PPA+xl9UxbouwW6Vr25Nc5x+gCkaVbJ\nG+DgEBguUPaaz7s7W+f2753G/H4AL0pyjHg9Kd4AAAAJcEhZcwAALiMAAC4j\nAXilP3YAAAAHdElNRQflBwYHEREhMLY6AAAAGXRFWHRDb21tZW50AENyZWF0\nZWQgd2l0aCBHSU1QV4EOFwAAAJ1JREFUeNrt0DERAAAIBCC1f+c3hJsHEegk\nxc0okChRIhIlSpSIRIkSJSJRokSJSJQoUSISJUqUiESJEpEoUaJEJEqUKBGJ\nEiVKRKJEiRKRKFGiRCRKlCgRiRIlIlGiRIlIlChRIhIlSpSIRIkSJSJRokSJ\nSJQoUSISJUpEokSJEpEoUaJEJEqUKBGJEiVKRKJEiRKRKFEiEiVK/GMBLwoD\n1VRze2wAAAAASUVORK5CYII=\n",
      "provider_name": "Example provider",
      "content": [
        {
          "text": "Updated World",
          "align": "left",
          "style": "paragraph",
          "type": "text"
        },
        {
          "table_style": "truncated",
          "items": [
            {
              "field": "Key",
              "value": "Value 1"
            }
          ],
          "type": "data_table"
        }
      ],
      "contexts": [
        {
          "type": "location",
          "lat": 30.0,
          "lng": 110.0
        },
        {
          "type": "field_crop",
          "field_crop_id": 64738,
          "scope": "financial_snapshot"
        }
      ],
      "created_at": "2011-06-15T02:30:00+00:00",
      "updated_at": "2011-06-15T02:30:00+00:00"
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/53280"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/frames/29020"
    }
  },
  "meta": {}
}

Layers

Create a layer

Endpoint

POST /api/layers

Parameters

  • required data.attributes. name
    Name of the layer.
    string
  • required data.attributes. category
    Pre-defined layer category. Valid categories are: Soil Survey, Sampling, Crop Sensing, Machinery Data, Other, Yield, Seeding Rate, Trial, Management Zone
    string
  • required data.attributes. northeast_lat
    Latitude of northeast point on layer bounding box.
    float
  • required data.attributes. northeast_lng
    Longitude of northeast point on layer bounding box.
    float
  • required data.attributes. southwest_lat
    Latitude of southwest point on layer bounding box.
    float
  • required data.attributes. southwest_lng
    Longitude of southwest point on layer bounding box.
    float
  • required data.attributes. legend_data
    Strictly formatted array of objects defining the layer legend. Each object contains the following names: 'area_scalar', 'area_units', 'color', 'label' which are all strings, except 'area_scalar' which is a float. 'color' must be a valid CSS color, e.g. #89ABCD
    json
  • required data.attributes. sourced_at
    Timestamp for layer creation.
    timestamp
  • data.attributes. description
    Description of the layer.
    string
  • data.attributes. subcategory
    Layer sub-category (optional).
    string
  • data.attributes. layer_information
    Any additional layer information. This is structured as an array of objects of { key: value } pairs.
    json
  • data.attributes. image_encoded
    Layer image encoded in Base64 format. Can only be set on POST or PATCH. NOTE: Either this OR image_url must be supplied.
    string
  • data.attributes. image_url
    Layer image file url for upload. NOTE: Either this OR image_encoded must be supplied.
    string

Relationships

  • required data.relationships.grower.data. id
    Grower id.
    integer
  • required data.relationships.grower.data. type
    Should always be 'growers'.
    string

Request

Route

POST /api/layers

Headers

Authorization: Bearer <token>
Content-Type: application/vnd.api+json

Body

{
  "data": {
    "type": "layers",
    "attributes": {
      "name": "My Created Layer",
      "category": "Sampling",
      "northeast_lat": -31.999,
      "northeast_lng": 115.979,
      "southwest_lat": -31.998,
      "southwest_lng": 115.98,
      "legend_data": [
        {
          "color": "#f4346d",
          "area_scalar": 30.5,
          "area_units": "ha",
          "label": "1.34 - 2.34 t/ha"
        },
        {
          "color": "#00FF44",
          "area_scalar": 61.0,
          "area_units": "ha",
          "label": "2.34 - 3.34 t/ha"
        },
        {
          "color": "#0055FF",
          "area_scalar": 91.5,
          "area_units": "ha",
          "label": "3.34 - 4.34 t/ha"
        }
      ],
      "layer_information": [
        {
          "label": "Min",
          "value": "1.34 t/ha"
        },
        {
          "label": "Max",
          "value": "4.34 t/ha"
        },
        {
          "label": "Mean",
          "value": "2.84 t/ha"
        },
        {
          "label": "Std Deviation",
          "value": "0.12482719"
        },
        {
          "label": "CV",
          "value": "0.37299402"
        },
        {
          "label": "Anything",
          "value": "you want"
        }
      ],
      "sourced_at": "2011-06-14T10:30:00.000+08:00",
      "image_encoded": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACMAAAAlCAYAAADIgFBEAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAA JcEhZcwAADsMAAA7DAcdvqGQAAACbSURBVFhH7dbRCYAwDATQxF06g/t/6godRo1EEOFQ24BB7kFp/TtiE6qy0SqL7V9aiujg5xSGDFU55KqM 7ykwDMIwSHeYqdR9RdDWOYMCjLX46Z3mCRxViavwO9MTNDxM628y/+qms56qmOZuipbvPeN7CgyDMAzCMEiqMDpLhRO4d7y/cTuBI19xT/DOI AyDMMyZtbQt/6TsRFb4jiKKeSA5xwAAAABJRU5ErkJggg=="
    },
    "relationships": {
      "grower": {
        "data": {
          "type": "growers",
          "id": 45000
        }
      }
    }
  }
}

Response

Simulated Response

Response Fields

  • name
    Name of the layer.
  • category
    Pre-defined layer category. Valid categories are: Soil Survey, Sampling, Crop Sensing, Machinery Data, Other, Yield, Seeding Rate, Trial, Management Zone
  • northeast_lat
    Latitude of northeast point on layer bounding box.
  • northeast_lng
    Longitude of northeast point on layer bounding box.
  • southwest_lat
    Latitude of southwest point on layer bounding box.
  • southwest_lng
    Longitude of southwest point on layer bounding box.
  • legend_data
    Strictly formatted array of objects defining the layer legend. Each object contains the following names: 'area_scalar', 'area_units', 'color', 'label' which are all strings, except 'area_scalar' which is a float. 'color' must be a valid CSS color, e.g. #89ABCD
  • sourced_at
    Timestamp for layer creation.
  • description
    Description of the layer.
  • subcategory
    Layer sub-category (optional).
  • layer_information
    Any additional layer information. This is structured as an array of objects of { key: value } pairs.
  • id
    Unique id of the layer.
  • image_url
    Layer image file url (local copy, may not match original source url provided).

Relationships

  • grower
    Grower this layer belongs to.

Status

201

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "60000",
    "type": "layers",
    "attributes": {
      "name": "My Created Layer",
      "category": "Sampling",
      "subcategory": null,
      "description": null,
      "legend_data": [
        {
          "color": "#f4346d",
          "area_scalar": 30.5,
          "area_units": "ha",
          "label": "1.34 - 2.34 t/ha"
        },
        {
          "color": "#00FF44",
          "area_scalar": 61.0,
          "area_units": "ha",
          "label": "2.34 - 3.34 t/ha"
        },
        {
          "color": "#0055FF",
          "area_scalar": 91.5,
          "area_units": "ha",
          "label": "3.34 - 4.34 t/ha"
        }
      ],
      "layer_information": [
        {
          "label": "Min",
          "value": "1.34 t/ha"
        },
        {
          "label": "Max",
          "value": "4.34 t/ha"
        },
        {
          "label": "Mean",
          "value": "2.84 t/ha"
        },
        {
          "label": "Std Deviation",
          "value": "0.12482719"
        },
        {
          "label": "CV",
          "value": "0.37299402"
        },
        {
          "label": "Anything",
          "value": "you want"
        }
      ],
      "northeast_lat": -31.998,
      "northeast_lng": 115.98,
      "southwest_lat": -31.999,
      "southwest_lng": 115.979,
      "sourced_at": "2011-06-14T02:30:00+00:00",
      "image_url": "http://localhost:3000/public/uploads/layers/image/layer_70a5f759-6f92-4371-aeff-0001d182534e-4de9c0d3befd1eb6e1b16bae.png"
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/45000"
        },
        "data": {
          "type": "growers",
          "id": "45000"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/layers/60000"
    }
  },
  "included": [
    {
      "id": "45000",
      "type": "growers",
      "attributes": {
        "name": "Grower",
        "description": null,
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "business_identifier": null,
        "organisation_id": "45000"
      },
      "relationships": {
        "fields": {
          "links": {
            "related": "http://localhost:3000/api/fields?filter[grower_id]=45000"
          }
        },
        "field_crops": {
          "links": {
            "related": "http://localhost:3000/api/field_crops?filter[grower_id]=45000"
          }
        },
        "farms": {
          "links": {
            "related": "http://localhost:3000/api/farms?filter[grower_id]=45000"
          }
        },
        "prescriptions": {
          "links": {
            "related": "http://localhost:3000/api/prescriptions?filter[grower_id]=45000"
          }
        },
        "field_boundaries": {
          "links": {
            "related": "http://localhost:3000/api/field_boundaries?filter[grower_id]=45000"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/growers/45000"
      }
    }
  ],
  "meta": {}
}

Delete a layer

Note: Layers can only be deleted using the application that created them.

Endpoint

DELETE /api/layers/:id

Parameters

  • required id
    Unique id of the layer.

Request

Route

DELETE /api/layers/50000

Headers

Authorization: Bearer <token>
Content-Type: application/x-www-form-urlencoded

Response

Simulated Response

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "50000",
    "type": "layers",
    "attributes": {
      "name": "My layer",
      "category": "Yield",
      "subcategory": null,
      "description": null,
      "legend_data": [
        {
          "color": "#f4346d",
          "label": "1.34 - 2.34 t/ha",
          "area_units": "ha",
          "area_scalar": 30.5
        },
        {
          "color": "#00FF44",
          "label": "2.34 - 3.34 t/ha",
          "area_units": "ha",
          "area_scalar": 61.0
        },
        {
          "color": "#0055FF",
          "label": "3.34 - 4.34 t/ha",
          "area_units": "ha",
          "area_scalar": 91.5
        }
      ],
      "layer_information": [
        {
          "label": "Min",
          "value": "1.34 t/ha"
        },
        {
          "label": "Max",
          "value": "4.34 t/ha"
        },
        {
          "label": "Mean",
          "value": "2.84 t/ha"
        },
        {
          "label": "Std Deviation",
          "value": "0.12482719"
        },
        {
          "label": "CV",
          "value": "0.37299402"
        },
        {
          "label": "Anything",
          "value": "you want"
        }
      ],
      "northeast_lat": null,
      "northeast_lng": null,
      "southwest_lat": null,
      "southwest_lng": null,
      "sourced_at": "2011-04-06T02:30:00+00:00",
      "image_url": "http://localhost:3000/public/uploads/layers/image/pct_surface-ed9c8e3b03dbef11eb16bae3.png"
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/45000"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/layers/50000"
    }
  },
  "meta": {}
}

Fetch details of the specific layer

Endpoint

GET /api/layers/:id

Parameters

  • required id
    Unique id of the layer.

Request

Route

GET /api/layers/50000

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • name
    Name of the layer.
  • category
    Pre-defined layer category. Valid categories are: Soil Survey, Sampling, Crop Sensing, Machinery Data, Other, Yield, Seeding Rate, Trial, Management Zone
  • northeast_lat
    Latitude of northeast point on layer bounding box.
  • northeast_lng
    Longitude of northeast point on layer bounding box.
  • southwest_lat
    Latitude of southwest point on layer bounding box.
  • southwest_lng
    Longitude of southwest point on layer bounding box.
  • legend_data
    Strictly formatted array of objects defining the layer legend. Each object contains the following names: 'area_scalar', 'area_units', 'color', 'label' which are all strings, except 'area_scalar' which is a float. 'color' must be a valid CSS color, e.g. #89ABCD
  • sourced_at
    Timestamp for layer creation.
  • description
    Description of the layer.
  • subcategory
    Layer sub-category (optional).
  • layer_information
    Any additional layer information. This is structured as an array of objects of { key: value } pairs.
  • id
    Unique id of the layer.
  • image_url
    Layer image file url (local copy, may not match original source url provided).

Relationships

  • grower
    Grower this layer belongs to.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "50000",
    "type": "layers",
    "attributes": {
      "name": "My layer",
      "category": "Yield",
      "subcategory": null,
      "description": null,
      "legend_data": [
        {
          "color": "#f4346d",
          "label": "1.34 - 2.34 t/ha",
          "area_units": "ha",
          "area_scalar": 30.5
        },
        {
          "color": "#00FF44",
          "label": "2.34 - 3.34 t/ha",
          "area_units": "ha",
          "area_scalar": 61.0
        },
        {
          "color": "#0055FF",
          "label": "3.34 - 4.34 t/ha",
          "area_units": "ha",
          "area_scalar": 91.5
        }
      ],
      "layer_information": [
        {
          "label": "Min",
          "value": "1.34 t/ha"
        },
        {
          "label": "Max",
          "value": "4.34 t/ha"
        },
        {
          "label": "Mean",
          "value": "2.84 t/ha"
        },
        {
          "label": "Std Deviation",
          "value": "0.12482719"
        },
        {
          "label": "CV",
          "value": "0.37299402"
        },
        {
          "label": "Anything",
          "value": "you want"
        }
      ],
      "northeast_lat": -31.998529,
      "northeast_lng": 115.980815,
      "southwest_lat": -31.999412,
      "southwest_lng": 115.979994,
      "sourced_at": "2011-04-06T02:30:00+00:00",
      "image_url": "http://localhost:3000/public/uploads/layers/image/pct_surface-ed9c8e3b03dbef11eb16bae3.png"
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/45000"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/layers/50000"
    }
  },
  "meta": {}
}

Fetch list of layers

Endpoint

GET /api/layers

Request

Route

GET /api/layers

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • name
    Name of the layer.
  • category
    Pre-defined layer category. Valid categories are: Soil Survey, Sampling, Crop Sensing, Machinery Data, Other, Yield, Seeding Rate, Trial, Management Zone
  • northeast_lat
    Latitude of northeast point on layer bounding box.
  • northeast_lng
    Longitude of northeast point on layer bounding box.
  • southwest_lat
    Latitude of southwest point on layer bounding box.
  • southwest_lng
    Longitude of southwest point on layer bounding box.
  • legend_data
    Strictly formatted array of objects defining the layer legend. Each object contains the following names: 'area_scalar', 'area_units', 'color', 'label' which are all strings, except 'area_scalar' which is a float. 'color' must be a valid CSS color, e.g. #89ABCD
  • sourced_at
    Timestamp for layer creation.
  • description
    Description of the layer.
  • subcategory
    Layer sub-category (optional).
  • layer_information
    Any additional layer information. This is structured as an array of objects of { key: value } pairs.
  • id
    Unique id of the layer.
  • image_url
    Layer image file url (local copy, may not match original source url provided).

Relationships

  • grower
    Grower this layer belongs to.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "50000",
      "type": "layers",
      "attributes": {
        "name": "My layer",
        "category": "Yield",
        "subcategory": null,
        "description": null,
        "legend_data": [
          {
            "color": "#f4346d",
            "label": "1.34 - 2.34 t/ha",
            "area_units": "ha",
            "area_scalar": 30.5
          },
          {
            "color": "#00FF44",
            "label": "2.34 - 3.34 t/ha",
            "area_units": "ha",
            "area_scalar": 61.0
          },
          {
            "color": "#0055FF",
            "label": "3.34 - 4.34 t/ha",
            "area_units": "ha",
            "area_scalar": 91.5
          }
        ],
        "layer_information": [
          {
            "label": "Min",
            "value": "1.34 t/ha"
          },
          {
            "label": "Max",
            "value": "4.34 t/ha"
          },
          {
            "label": "Mean",
            "value": "2.84 t/ha"
          },
          {
            "label": "Std Deviation",
            "value": "0.12482719"
          },
          {
            "label": "CV",
            "value": "0.37299402"
          },
          {
            "label": "Anything",
            "value": "you want"
          }
        ],
        "northeast_lat": -31.998529,
        "northeast_lng": 115.980815,
        "southwest_lat": -31.999412,
        "southwest_lng": 115.979994,
        "sourced_at": "2011-04-06T02:30:00+00:00",
        "image_url": "http://localhost:3000/public/uploads/layers/image/pct_surface-ed9c8e3b03dbef11eb16bae3.png"
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/45000"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/layers/50000"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/layers?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/layers?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/layers?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Update a layer

Note: Layers can only be modified using the application that created them.

Endpoint

PATCH /api/layers/:id

Parameters

  • required data. id
    Unique id of the layer.
  • required data. type
    Should always be 'layers'.
    string
  • data.attributes. name
    Name of the layer.
    string
  • data.attributes. category
    Pre-defined layer category. Valid categories are: Soil Survey, Sampling, Crop Sensing, Machinery Data, Other, Yield, Seeding Rate, Trial, Management Zone
    string
  • data.attributes. northeast_lat
    Latitude of northeast point on layer bounding box.
    float
  • data.attributes. northeast_lng
    Longitude of northeast point on layer bounding box.
    float
  • data.attributes. southwest_lat
    Latitude of southwest point on layer bounding box.
    float
  • data.attributes. southwest_lng
    Longitude of southwest point on layer bounding box.
    float
  • data.attributes. legend_data
    Strictly formatted array of objects defining the layer legend. Each object contains the following names: 'area_scalar', 'area_units', 'color', 'label' which are all strings, except 'area_scalar' which is a float. 'color' must be a valid CSS color, e.g. #89ABCD
    json
  • data.attributes. sourced_at
    Timestamp for layer creation.
    timestamp
  • data.attributes. description
    Description of the layer.
    string
  • data.attributes. subcategory
    Layer sub-category (optional).
    string
  • data.attributes. layer_information
    Any additional layer information. This is structured as an array of objects of { key: value } pairs.
    json
  • data.attributes. image_encoded
    Layer image encoded in Base64 format. Can only be set on POST or PATCH. NOTE: Either this OR image_url must be supplied.
    string
  • data.attributes. image_url
    Layer image file url for upload. NOTE: Either this OR image_encoded must be supplied.
    string

Request

Route

PATCH /api/layers/50000

Headers

Authorization: Bearer <token>
Content-Type: application/vnd.api+json

Body

{
  "data": {
    "type": "layers",
    "id": 50000,
    "attributes": {
      "name": "Updated layer name"
    }
  }
}

Response

Simulated Response

Response Fields

  • name
    Name of the layer.
  • category
    Pre-defined layer category. Valid categories are: Soil Survey, Sampling, Crop Sensing, Machinery Data, Other, Yield, Seeding Rate, Trial, Management Zone
  • northeast_lat
    Latitude of northeast point on layer bounding box.
  • northeast_lng
    Longitude of northeast point on layer bounding box.
  • southwest_lat
    Latitude of southwest point on layer bounding box.
  • southwest_lng
    Longitude of southwest point on layer bounding box.
  • legend_data
    Strictly formatted array of objects defining the layer legend. Each object contains the following names: 'area_scalar', 'area_units', 'color', 'label' which are all strings, except 'area_scalar' which is a float. 'color' must be a valid CSS color, e.g. #89ABCD
  • sourced_at
    Timestamp for layer creation.
  • description
    Description of the layer.
  • subcategory
    Layer sub-category (optional).
  • layer_information
    Any additional layer information. This is structured as an array of objects of { key: value } pairs.
  • id
    Unique id of the layer.
  • image_url
    Layer image file url (local copy, may not match original source url provided).

Relationships

  • grower
    Grower this layer belongs to.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "50000",
    "type": "layers",
    "attributes": {
      "name": "Updated layer name",
      "category": "Yield",
      "subcategory": null,
      "description": null,
      "legend_data": [
        {
          "color": "#f4346d",
          "label": "1.34 - 2.34 t/ha",
          "area_units": "ha",
          "area_scalar": 30.5
        },
        {
          "color": "#00FF44",
          "label": "2.34 - 3.34 t/ha",
          "area_units": "ha",
          "area_scalar": 61.0
        },
        {
          "color": "#0055FF",
          "label": "3.34 - 4.34 t/ha",
          "area_units": "ha",
          "area_scalar": 91.5
        }
      ],
      "layer_information": [
        {
          "label": "Min",
          "value": "1.34 t/ha"
        },
        {
          "label": "Max",
          "value": "4.34 t/ha"
        },
        {
          "label": "Mean",
          "value": "2.84 t/ha"
        },
        {
          "label": "Std Deviation",
          "value": "0.12482719"
        },
        {
          "label": "CV",
          "value": "0.37299402"
        },
        {
          "label": "Anything",
          "value": "you want"
        }
      ],
      "northeast_lat": -31.998529,
      "northeast_lng": 115.980815,
      "southwest_lat": -31.999412,
      "southwest_lng": 115.979994,
      "sourced_at": "2011-04-06T02:30:00+00:00",
      "image_url": "http://localhost:3000/public/uploads/layers/image/pct_surface-ed9c8e3b03dbef11eb16bae3.png"
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/45000"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/layers/50000"
    }
  },
  "meta": {}
}

Prescriptions

Create a prescription with valid attributes

Endpoint

POST /api/prescriptions

Parameters

  • required data.attributes. name
    Name of the prescription.
    string
  • required data.attributes. date_intended_for
    The date the prescription is intended to be used. This will be used to determine the correct Agworld season.
    date
  • required data.attributes. generated_at
    The date and time that the prescription/controller files were actually created.
    timestamp
  • data.attributes. controller_file_rate_column_name
    The name of the column in the shapefiles database that contains application rate values. This value must be provided in cases where the shapefiles database contains more than a single column of values.
    string
  • required data.attributes. controller_file_application_rate_units
    The units that the controller files' rate values are specified in terms of.
    string
  • required data.attributes. controller_file_encoded
    Controller file zip encoded in Base64 format.
    string
  • data.attributes. starter_credit
    The rate for fertiliser that is assumed will be applied when the crop is seeded into the field
    float
  • data.attributes. image_data.image_encoded
    Image encoded in Base64 format. Can only be set on POST. NOTE: If image is provided, all other image_data attributes are required.
    string
  • data.attributes. image_data.northeast_lat
    Northeast latitude coordinate of the image. This will be used as anchor point to overlay field map.
    float
  • data.attributes. image_data.northeast_lng
    Northeast longitude coordinate of the image. This will be used as anchor point to overlay field map.
    float
  • data.attributes. image_data.southwest_lat
    Southwest latitude coordinate of the image. This will be used as anchor point to overlay field map.
    float
  • data.attributes. image_data.southwest_lng
    Southwest longitude coordinate of the image. This will be used as anchor point to overlay field map.
    float
  • data.attributes. image_data.legend_data
    Strictly formatted array of objects defining the legend of the image. Each object contains the following names: 'area_scalar', 'area_units', 'color', 'label' which are all strings, except 'area_scalar' which is a float. 'color' must be a valid HEX color, e.g. #89ABCD
    json

Relationships

  • required data.relationships.grower.data. id
    Grower id.
    integer
  • required data.relationships.grower.data. type
    Should always be 'growers'.
    string
  • data.relationships.field.data. id
    Field ID (optional). By default, prescriptions will be matched to whichever field has greatest geospatial overlap with the prescription geojson. Providing a field ID ensures the intended field is selected when prescription area may intersect multiple fields.
    integer
  • data.relationships.field.data. type
    Should always be 'fields'.
    string

Request

Route

POST /api/prescriptions

Headers

Authorization: Bearer <token>
Content-Type: application/vnd.api+json

Body

{
  "data": {
    "type": "prescriptions",
    "attributes": {
      "name": "API Created",
      "date_intended_for": "2018-01-02",
      "generated_at": "2011-06-15T10:30:00.000+08:00",
      "controller_file_application_rate_units": "kg/ha",
      "controller_file_encoded": "UEsDBBQACAAIAA5/5lIAAAAAAAAAAGwAAAALACAAZXhhbXBsZS5zaHhVVA0A\nB6wM5GBRDeRgrAzkYHV4CwABBPUBAAAEFAAAAGNgUOdiwA7MXjAzMLACGb6m\nAV+koiMP+K9kNJ922smh6tsKvb9RkQdKHKpuLgLycehHBkZA7AAAUEsHCDZ5\nE004AAAAbAAAAFBLAwQUAAgACAAOf+ZSAAAAAAAAAADsAAAACwAgAGV4YW1w\nbGUuc2hwVVQNAAesDORgRg3kYKwM5GB1eAsAAQT1AQAABBQAAABjYFDnYsAO\nyl4wMzCwAhm+pgFfpKIjD/ivZDSfdtrJoerbCr2/UZEHShyqbi4C8nHoRwaM\nQOxAjFkghaxQTTC1MLl9pefckNXC9Dq6BvyeD+RvTZq6C8SHmY2uHwBQSwcI\nDhnAj10AAADsAAAAUEsDBBQACAAIAA5/5lIAAAAAAAAAAFsAAAALACAAZXhh\nbXBsZS5kYmZVVA0AB6wM5GC2DORgrAzkYHV4CwABBPUBAAAEFAAAAGOuZGdj\nZGBgcGSQZMAGfEuLMhNLUuPz0xj8QHwJflR5XgUwMDI20TNABVIAUEsHCM/E\nZcksAAAAWwAAAFBLAQIUAxQACAAIAA5/5lI2eRNNOAAAAGwAAAALACAAAAAA\nAAAAAACkgQAAAABleGFtcGxlLnNoeFVUDQAHrAzkYFEN5GCsDORgdXgLAAEE\n9QEAAAQUAAAAUEsBAhQDFAAIAAgADn/mUg4ZwI9dAAAA7AAAAAsAIAAAAAAA\nAAAAAKSBkQAAAGV4YW1wbGUuc2hwVVQNAAesDORgRg3kYKwM5GB1eAsAAQT1\nAQAABBQAAABQSwECFAMUAAgACAAOf+ZSz8RlySwAAABbAAAACwAgAAAAAAAA\nAAAApIFHAQAAZXhhbXBsZS5kYmZVVA0AB6wM5GC2DORgrAzkYHV4CwABBPUB\nAAAEFAAAAFBLBQYAAAAAAwADAAsBAADMAQAAAAA=\n",
      "image_data": {
        "image_encoded": "/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwM\nDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcB\nCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3\nNzc3Nzc3Nzc3Nzc3Nzc3Nzc3N//AABEIAGQAZAMBIgACEQEDEQH/xAAbAAAB\nBQEBAAAAAAAAAAAAAAAAAQIDBAUGB//EADkQAAEDAgQEAwYDBwUAAAAAAAEA\nAhEDIQQSMUFRYXGBBRMiBhQykaHRQsHwcoOSorHh8TNDU3OC/8QAGAEBAQEB\nAQAAAAAAAAAAAAAAAQACAwX/xAAjEQEAAgECBgMBAAAAAAAAAAAAARESAiED\nFBVCUmEEQVEF/9oADAMBAAIRAxEAPwD0Q1r6qWnWBWe2ajoWzgcNRaA54k81\n0c0jaTntBAsh1EkRF1oMewNgRCAaczARZpnsoOGytUWlohTl9PkgOp7FRpXr\ngASVm1iZMCy16zWVGwSostFn4QeqkxHU6pvlVaq0tJzBdE403bBUq+EY92ZN\ninPVHwqtSoSd10T8FhgPUJVephMPmkDsmxTn5fwKFunDUzpCE2klNrKZmQrT\ncUOK5sY4uOqmp4qd1kW6MYkxqg4k8ViNxXNK7FCNVG2ucXzSHGZdCsOpigLq\nH3wuNipW6B3iBA1Vd3iZmJWR5jnHVWsMwb3lStdp49xdxV6hiQ8w4X4KjTww\nFw4BXaTWi7qt+MIKWqKZJtbZVfdcxJLrcFepDDk6kjmVI51CYbCrLMOHg7oW\nllp7mEJFPNS188koNRpsSsoe02EOtGuOzT+amZ7R4Ej1Cs3rTH3XHmuD5MYy\n0hUqnipA9w3IWe3x/wAPj/VeOtMqRvj3hm9Un9277LXMcHyhVK62XkZnK5So\ngQRcLIHtB4U02Lj+7KD7U+Hts2hXdwhoH5rM/J4Md0KIl0bG0gJI+qdnH+2O\ny5ap7W4fSlgajv2nhv3VSp7XYuB5WDw7LXzEu/MLlq+bwI+28ZdsH1nGxgdV\nMxmJcLB0dF5vW9pvGavw4oUxsKVMCO+v1WZicZjsVIxGLrVQdqtRzv6lcdX9\nHR2wY0vWX1xRs/EU2Hg54CWnjWajF4af+5v3Xj2R7bS0dkkVJ+Ns9Fz6jPi1\njD2T3zNf3mh2qt+6F4xkrDV1P+H+6E9R9LFJDRsE6x0EdlGKo59QJTxUJFrd\nRC8vcWL7BAzcEGpGp+hSh5i39IRuLGVxG/ZKGuG4HUJHOcBfZAe3UwOit1ZR\nTfu7+VPayx1+aaa0Dc900VhPBW6tIadkmQc02XHRx+aSXTrPUoonljAN+yaW\nM/RSF4O89CmZxwPzTESLOyM4/wAyVRF19J/9IWqlWZ5oB1PQILxu35gKq02+\nKOqlbUI0IK6TpZSedI/AOycHEwSbclH51QfF6kCq5231RiEwkgk9pJQHhuwH\nQlRiqNE4OOsA8kUTvNn8Mjql82BIbA6phdNnUgOyTLTm+ccstlVCONW/HqgV\nZMFpHySeW3apPIhNcwTEddlVC3OzsncdkEsOoPzUbacCO+spbNMkfOyahblH\nl/ooTT5ZM+juhNJVOUn0lo/aJKdlsC4W5bqNtN+UEVOwKTy3N+C3HZdtv0JQ\n7hboUjqhm2aORTCawkgx2lKXVSPxzwghVA4VQRZwcRsTKUVjHqDR3TTVc259\nVlG6sZBeGDqrErAcS6zJkaAozuY6QXtHBQe8wXSG/OEeY17rEg9kYektecf+\nQd23TDWqakAyq4c0x6ifognKYbmnmDCcEkdiS0w57GidCbo94k5Q6eeqhcaT\nvjaCQN2wowKExknmLQtYwVpuIY0evITxskVaaZ+E25/5QrHSbXMoghI6WNGV\nxFgkQsMmOqvvcXPBTZjcG4EWPZKhMxsjBepBvEAJzmsLSCwGEqESSOos8okW\nJUFam2nTzgCeaEJ0TKRNdLZytsDtwSy6JLiUIXUJG0wWg3uY1TzQaWiXOM31\nSIWJkmCiwgEhCEKuQ//Z\n",
        "northeast_lat": 39.91380399903349,
        "northeast_lng": -96.47331341380773,
        "southwest_lat": 39.92137580863364,
        "southwest_lng": -96.46348000701228,
        "legend_data": [
          {
            "color": "#f4346d",
            "area_scalar": 30.5,
            "area_units": "ha",
            "label": "1.34 - 2.34 t/ha"
          },
          {
            "color": "#ffffff",
            "area_scalar": 200.5,
            "area_units": "ha",
            "label": "0 - 1.33 t/ha"
          }
        ]
      },
      "starter_credit": 4.3
    },
    "relationships": {
      "grower": {
        "data": {
          "type": "growers",
          "id": 45000
        }
      },
      "field": {
        "data": {
          "type": "field",
          "id": 50000
        }
      }
    }
  }
}

Response

Simulated Response

Response Fields

  • name
    Name of the prescription.
  • date_intended_for
    The date the prescription is intended to be used. This will be used to determine the correct Agworld season.
  • generated_at
    The date and time that the prescription/controller files were actually created.
  • controller_file_rate_column_name
    The name of the column in the shapefiles database that contains application rate values. This value must be provided in cases where the shapefiles database contains more than a single column of values.
  • controller_file_application_rate_units
    The units that the controller files' rate values are specified in terms of.
  • controller_file_encoded
    Controller file zip encoded in Base64 format.
  • starter_credit
    The rate for fertiliser that is assumed will be applied when the crop is seeded into the field
  • image_data.northeast_lat
    Northeast latitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.northeast_lng
    Northeast longitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.southwest_lat
    Southwest latitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.southwest_lng
    Southwest longitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.legend_data
    Strictly formatted array of objects defining the legend of the image. Each object contains the following names: 'area_scalar', 'area_units', 'color', 'label' which are all strings, except 'area_scalar' which is a float. 'color' must be a valid HEX color, e.g. #89ABCD
  • image_data.image_url
    URL of uploaded prescription image.
  • id
    Unique id of the prescription.

Relationships

  • grower
    Grower this prescription belongs to.
  • field
    Field this prescription is associated with.

Status

201

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "80002",
    "type": "prescriptions",
    "attributes": {
      "grower_id": "45000",
      "field_id": "50000",
      "name": "API Created",
      "generated_at": "2011-06-15T02:30:00+00:00",
      "controller_file_application_rate_units": null,
      "controller_file_encoded": null,
      "controller_file_rate_column_name": null,
      "starter_credit": 4.3,
      "created_at": "2011-06-15T02:30:00+00:00",
      "updated_at": "2011-06-15T02:30:00+00:00",
      "controller_files_url": "http://localhost:3000/public/uploads/precision/prescriptions/controller_files/grower_farm_1_field_1_api_created_e1b16b4de9efd1eb6aec0d3b.zip",
      "approved": false,
      "min_rate_scalar": 234.0,
      "min_rate_units": "kg/ha",
      "max_rate_scalar": 234.0,
      "max_rate_units": "kg/ha",
      "mean_rate_scalar": 156.0,
      "mean_rate_units": "kg/ha",
      "total_product_scalar": 234.0,
      "total_product_units": "kg",
      "application_area_scalar": 1.0,
      "application_area_units": "ha",
      "image_data": {
        "image_url": "http://localhost:3000/public/uploads/map_images/image/rx_5e0b4400-96f7-11e0-9323-faffc2106912-e1b16b4de9efd1eb6aec0d3b.png",
        "northeast_lat": 39.91380399903349,
        "northeast_lng": -96.47331341380773,
        "southwest_lat": 39.92137580863364,
        "southwest_lng": -96.46348000701228,
        "legend_data": [
          {
            "color": "#f4346d",
            "area_scalar": 30.5,
            "area_units": "ha",
            "label": "1.34 - 2.34 t/ha"
          },
          {
            "color": "#ffffff",
            "area_scalar": 200.5,
            "area_units": "ha",
            "label": "0 - 1.33 t/ha"
          }
        ]
      }
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/45000"
        },
        "data": {
          "type": "growers",
          "id": "45000"
        }
      },
      "field": {
        "links": {
          "related": "http://localhost:3000/api/fields/50000"
        },
        "data": {
          "type": "fields",
          "id": "50000"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/prescriptions/80002"
    }
  },
  "included": [
    {
      "id": "45000",
      "type": "growers",
      "attributes": {
        "name": "Grower",
        "description": null,
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "business_identifier": null,
        "organisation_id": "45000"
      },
      "relationships": {
        "fields": {
          "links": {
            "related": "http://localhost:3000/api/fields?filter[grower_id]=45000"
          }
        },
        "field_crops": {
          "links": {
            "related": "http://localhost:3000/api/field_crops?filter[grower_id]=45000"
          }
        },
        "farms": {
          "links": {
            "related": "http://localhost:3000/api/farms?filter[grower_id]=45000"
          }
        },
        "prescriptions": {
          "links": {
            "related": "http://localhost:3000/api/prescriptions?filter[grower_id]=45000"
          }
        },
        "field_boundaries": {
          "links": {
            "related": "http://localhost:3000/api/field_boundaries?filter[grower_id]=45000"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/growers/45000"
      }
    },
    {
      "id": "50000",
      "type": "fields",
      "attributes": {
        "name": "Field 1",
        "description": null,
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "irrigated": null
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/45000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/51123"
          }
        },
        "prescriptions": {
          "links": {
            "related": "http://localhost:3000/api/prescriptions?filter[field_id]=50000"
          }
        },
        "field_boundaries": {
          "links": {
            "related": "http://localhost:3000/api/field_boundaries?filter[field_id]=50000"
          }
        },
        "field_crops": {
          "links": {
            "related": "http://localhost:3000/api/field_crops?filter[field_id]=50000"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/fields/50000"
      }
    }
  ],
  "meta": {}
}

Delete a prescription

Endpoint

DELETE /api/prescriptions/:id

Parameters

  • required id
    Unique id of the Prescription.

Request

Route

DELETE /api/prescriptions/80000

Headers

Authorization: Bearer <token>
Content-Type: application/x-www-form-urlencoded

Response

Simulated Response

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "80000",
    "type": "prescriptions",
    "attributes": {
      "grower_id": "45000",
      "field_id": "50000",
      "name": "RX potash - blah blah",
      "generated_at": null,
      "controller_file_application_rate_units": null,
      "controller_file_encoded": null,
      "controller_file_rate_column_name": null,
      "starter_credit": null,
      "created_at": "2011-06-15T02:30:00+00:00",
      "updated_at": "2011-06-15T02:30:00+00:00",
      "controller_files_url": null,
      "approved": false,
      "min_rate_scalar": 2.0,
      "min_rate_units": "lbs/acre",
      "max_rate_scalar": 18.0,
      "max_rate_units": "lbs/acre",
      "mean_rate_scalar": 4.4,
      "mean_rate_units": "lbs/acre",
      "total_product_scalar": 222,
      "total_product_units": "lbs",
      "application_area_scalar": 40.468564224,
      "application_area_units": "ha",
      "image_data": {
        "image_url": null,
        "northeast_lat": null,
        "northeast_lng": null,
        "southwest_lat": null,
        "southwest_lng": null,
        "legend_data": null
      }
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/45000"
        }
      },
      "field": {
        "links": {
          "related": "http://localhost:3000/api/fields/50000"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/prescriptions/80000"
    }
  },
  "meta": {}
}

Fetch details of specific prescription

Endpoint

GET api/prescriptions/:id

Parameters

Relationships

  • data.relationships.field.data. id
    Field Id.
    integer
  • data.relationships.field.data. type
    Should always be 'fields'.
    string

Request

Route

GET api/prescriptions/80000?data.relationships.field.data[id]=80000

Headers

Authorization: Bearer <token>

Query Parameters

data.relationships.field.data={"id"=>"80000"}

Response

Simulated Response

Response Fields

  • name
    Name of the prescription.
  • date_intended_for
    The date the prescription is intended to be used. This will be used to determine the correct Agworld season.
  • generated_at
    The date and time that the prescription/controller files were actually created.
  • controller_file_rate_column_name
    The name of the column in the shapefiles database that contains application rate values. This value must be provided in cases where the shapefiles database contains more than a single column of values.
  • controller_file_application_rate_units
    The units that the controller files' rate values are specified in terms of.
  • controller_file_encoded
    Controller file zip encoded in Base64 format.
  • starter_credit
    The rate for fertiliser that is assumed will be applied when the crop is seeded into the field
  • image_data.northeast_lat
    Northeast latitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.northeast_lng
    Northeast longitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.southwest_lat
    Southwest latitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.southwest_lng
    Southwest longitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.legend_data
    Strictly formatted array of objects defining the legend of the image. Each object contains the following names: 'area_scalar', 'area_units', 'color', 'label' which are all strings, except 'area_scalar' which is a float. 'color' must be a valid HEX color, e.g. #89ABCD
  • image_data.image_url
    URL of uploaded prescription image.
  • id
    Unique id of the prescription.

Relationships

  • grower
    Grower this prescription belongs to.
  • field
    Field this prescription is associated with.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": {
    "id": "80000",
    "type": "prescriptions",
    "attributes": {
      "grower_id": "45000",
      "field_id": "50000",
      "name": "RX potash - blah blah",
      "generated_at": null,
      "controller_file_application_rate_units": null,
      "controller_file_encoded": null,
      "controller_file_rate_column_name": null,
      "starter_credit": null,
      "created_at": "2011-06-15T02:30:00+00:00",
      "updated_at": "2011-06-15T02:30:00+00:00",
      "controller_files_url": null,
      "approved": false,
      "min_rate_scalar": 2.0,
      "min_rate_units": "lbs/acre",
      "max_rate_scalar": 18.0,
      "max_rate_units": "lbs/acre",
      "mean_rate_scalar": 4.4,
      "mean_rate_units": "lbs/acre",
      "total_product_scalar": 222,
      "total_product_units": "lbs",
      "application_area_scalar": 40.468564224,
      "application_area_units": "ha",
      "image_data": {
        "image_url": null,
        "northeast_lat": null,
        "northeast_lng": null,
        "southwest_lat": null,
        "southwest_lng": null,
        "legend_data": null
      }
    },
    "relationships": {
      "grower": {
        "links": {
          "related": "http://localhost:3000/api/growers/45000"
        }
      },
      "field": {
        "links": {
          "related": "http://localhost:3000/api/fields/50000"
        }
      }
    },
    "links": {
      "self": "http://localhost:3000/api/prescriptions/80000"
    }
  },
  "meta": {}
}

Fetch list of prescriptions

Endpoint

GET api/prescriptions

Request

Route

GET api/prescriptions

Headers

Authorization: Bearer <token>

Response

Simulated Response

Response Fields

  • name
    Name of the prescription.
  • date_intended_for
    The date the prescription is intended to be used. This will be used to determine the correct Agworld season.
  • generated_at
    The date and time that the prescription/controller files were actually created.
  • controller_file_rate_column_name
    The name of the column in the shapefiles database that contains application rate values. This value must be provided in cases where the shapefiles database contains more than a single column of values.
  • controller_file_application_rate_units
    The units that the controller files' rate values are specified in terms of.
  • controller_file_encoded
    Controller file zip encoded in Base64 format.
  • starter_credit
    The rate for fertiliser that is assumed will be applied when the crop is seeded into the field
  • image_data.northeast_lat
    Northeast latitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.northeast_lng
    Northeast longitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.southwest_lat
    Southwest latitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.southwest_lng
    Southwest longitude coordinate of the image. This will be used as anchor point to overlay field map.
  • image_data.legend_data
    Strictly formatted array of objects defining the legend of the image. Each object contains the following names: 'area_scalar', 'area_units', 'color', 'label' which are all strings, except 'area_scalar' which is a float. 'color' must be a valid HEX color, e.g. #89ABCD
  • image_data.image_url
    URL of uploaded prescription image.
  • id
    Unique id of the prescription.

Relationships

  • grower
    Grower this prescription belongs to.
  • field
    Field this prescription is associated with.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "80000",
      "type": "prescriptions",
      "attributes": {
        "grower_id": "45000",
        "field_id": "50000",
        "name": "RX potash - blah blah",
        "generated_at": null,
        "controller_file_application_rate_units": null,
        "controller_file_encoded": null,
        "controller_file_rate_column_name": null,
        "starter_credit": null,
        "created_at": "2011-06-15T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "controller_files_url": null,
        "approved": false,
        "min_rate_scalar": 2.0,
        "min_rate_units": "lbs/acre",
        "max_rate_scalar": 18.0,
        "max_rate_units": "lbs/acre",
        "mean_rate_scalar": 4.4,
        "mean_rate_units": "lbs/acre",
        "total_product_scalar": 222,
        "total_product_units": "lbs",
        "application_area_scalar": 40.468564224,
        "application_area_units": "ha",
        "image_data": {
          "image_url": null,
          "northeast_lat": null,
          "northeast_lng": null,
          "southwest_lat": null,
          "southwest_lng": null,
          "legend_data": null
        }
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/45000"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/50000"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/prescriptions/80000"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/prescriptions?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/prescriptions?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/prescriptions?page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Stock Item Events

The stock item events resource returns quantities/amounts of consumable stock items used in Agworld activities. Stock items are defined as: products (chemicals & fertilizer), seeds and any cost activities using liquid units (in particular fuel/gas) Stock item events are defined as an occasion when a stock item event is consumed.

One stock item event is returned per stock item, per field, per activity.

This resource can return stock items consumed historically or forecast to be consumed depending on the activity status. Historical consumption is helpful for integration situations such as reducing stock inventory levels, whereas forecast consumption supports future consumption use cases such as procurement. Stock Items can also return specific job statuses which reflect the latest activity within a job, such as the recommendation for a job that contains a plan and a recommendation.

When authenticated as a user belonging to a grower company/company-group, stock-item events will be returned for all activities that this user has permission to read in Agworld. When authenticated as a user belonging to a third-party company/company-group that has relationships with a grower (e.g. retailer or advisor), stock item events will be returned for all data that the user has permission to read AND has been authored by users within their own company/company-group.

Performance

When making requests that return results for multiple growers, queries may take too long to run. This will return a 500 error: “Error running query: The query took too long to run. Please try filtering by grower_id and/or adding other additional filters”. It is recommended that you filter by grower_id to make a performant request. You can get a list of grower_ids that the authenticated user has permission to read, by fetching a list of growers. ​

Fetch stock item events for activities completed after a specified event date

Endpoint

GET api/stock_item_events

Parameters

  • filter[grower_id]
    Filter results by one or more (comma-separated) grower ids. For performance reasons, this filter is recommended.
  • filter[completed]
    Filter result by whether or not the associated activities have been completed.
  • filter[event_date]
    Filter result by the event date (can specify [before] or [after]).
  • filter[field_id]
    Filter results by one or more (comma-separated) field ids.
  • filter[activity_id]
    Filter results by one or more (comma-separated) activity ids.
  • filter[activity_tag]
    Filter by one or more (comma-separated) tags at the activity level (case insensitive).
  • filter[input_tag]
    Filter by one or more (comma-separated) tags at the activity input level (case insensitive).
  • filter[job_stage]
    Filter by a job stage: ‘PlannedActivity’, ‘RecommendedActivity’, ‘WorkOrder’ or ‘ActualActivity’.
  • filter[updated_at]
    Filter results by the date that the associated activity was last updated (can specify [before] or [after]).

Request

Route

GET api/stock_item_events?filter[completed]=true&filter[event_date][after]=2011-06-15+10%3A30

Headers

Authorization: Bearer <token>

Query Parameters

filter={"completed"=>"true", "event_date"=>{"after"=>"2011-06-15 10:30"}}

Response

Simulated Response

Response Fields

  • activity_data
    Contains a JSON object containing values for the associated activity.
  • completed
    Indicates if the associated activity has been completed. Will be either true or false.
  • event_date
    The date the associated activity was completed or is due to complete.
  • updated_at
    The date that the associated activity was last updated.
  • created_at
    The date the associated activity was created.
  • name
    Name of product or crop variety.
  • type
    Type of the stock item. Will be either Product, CropVariety or CostActivity.
  • item_id
    The Agworld global identifier for the activity input.
  • item_supplier_name
    The name of the company that supplied the product.
  • item_national_registration_number
    The national identification number for registered inputs.
  • amount
    The scalar value of the input rate.
  • amount_unit
    The units that the input rate is expressed in terms of.
  • area
    The scalar value of the activity area.
  • area_unit
    The units that the activity area is expressed in terms of.
  • input_tags
    The tags that have been applied to the activity input.

Relationships

  • grower
    Links to the associated grower for this event.
  • farm
    Links to the associated farm for this event.
  • field
    Links to the associated field for this event.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "AIID10000APID10000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/560eddab-1a8b-4aeb-ac71-989d23848f72",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Bones",
        "type": "Product",
        "item_id": "PRO9000AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 800.0,
        "amount_unit": "kg",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": [
          "also only four"
        ]
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID10000APID10000AID50000"
      }
    },
    {
      "id": "AIID10000APID20000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/560eddab-1a8b-4aeb-ac71-989d23848f72",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Bones",
        "type": "Product",
        "item_id": "PRO9000AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1200.0,
        "amount_unit": "kg",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": [
          "also only four"
        ]
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID10000APID20000AID50000"
      }
    },
    {
      "id": "AIID20000APID10000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/560eddab-1a8b-4aeb-ac71-989d23848f72",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Water",
        "type": "Product",
        "item_id": "PRO4949AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1000.0,
        "amount_unit": "L",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID20000APID10000AID50000"
      }
    },
    {
      "id": "AIID20000APID20000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/560eddab-1a8b-4aeb-ac71-989d23848f72",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Water",
        "type": "Product",
        "item_id": "PRO4949AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1500.0,
        "amount_unit": "L",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID20000APID20000AID50000"
      }
    },
    {
      "id": "AIID30000APID10000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/560eddab-1a8b-4aeb-ac71-989d23848f72",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Paramondas",
        "type": "CropVariety",
        "item_id": "CRP7989AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 400.0,
        "amount_unit": "kg",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID30000APID10000AID50000"
      }
    },
    {
      "id": "AIID30000APID20000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/560eddab-1a8b-4aeb-ac71-989d23848f72",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Paramondas",
        "type": "CropVariety",
        "item_id": "CRP7989AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 600.0,
        "amount_unit": "kg",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID30000APID20000AID50000"
      }
    },
    {
      "id": "AIID50000APID10000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/560eddab-1a8b-4aeb-ac71-989d23848f72",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Soylent",
        "type": "CostActivity",
        "item_id": "CST7373AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 400.0,
        "amount_unit": "L",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID50000APID10000AID50000"
      }
    },
    {
      "id": "AIID50000APID20000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/560eddab-1a8b-4aeb-ac71-989d23848f72",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Soylent",
        "type": "CostActivity",
        "item_id": "CST7373AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 600.0,
        "amount_unit": "L",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID50000APID20000AID50000"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=true&filter%5Bevent_date%5D%5Bafter%5D=2011-06-15+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=true&filter%5Bevent_date%5D%5Bafter%5D=2011-06-15+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=true&filter%5Bevent_date%5D%5Bafter%5D=2011-06-15+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Fetch stock item events for activities completed before a specified event date

Endpoint

GET api/stock_item_events

Parameters

  • filter[grower_id]
    Filter results by one or more (comma-separated) grower ids. For performance reasons, this filter is recommended.
  • filter[completed]
    Filter result by whether or not the associated activities have been completed.
  • filter[event_date]
    Filter result by the event date (can specify [before] or [after]).
  • filter[field_id]
    Filter results by one or more (comma-separated) field ids.
  • filter[activity_id]
    Filter results by one or more (comma-separated) activity ids.
  • filter[activity_tag]
    Filter by one or more (comma-separated) tags at the activity level (case insensitive).
  • filter[input_tag]
    Filter by one or more (comma-separated) tags at the activity input level (case insensitive).
  • filter[job_stage]
    Filter by a job stage: ‘PlannedActivity’, ‘RecommendedActivity’, ‘WorkOrder’ or ‘ActualActivity’.
  • filter[updated_at]
    Filter results by the date that the associated activity was last updated (can specify [before] or [after]).

Request

Route

GET api/stock_item_events?filter[completed]=true&filter[event_date][before]=2011-06-15+10%3A30

Headers

Authorization: Bearer <token>

Query Parameters

filter={"completed"=>"true", "event_date"=>{"before"=>"2011-06-15 10:30"}}

Response

Simulated Response

Response Fields

  • activity_data
    Contains a JSON object containing values for the associated activity.
  • completed
    Indicates if the associated activity has been completed. Will be either true or false.
  • event_date
    The date the associated activity was completed or is due to complete.
  • updated_at
    The date that the associated activity was last updated.
  • created_at
    The date the associated activity was created.
  • name
    Name of product or crop variety.
  • type
    Type of the stock item. Will be either Product, CropVariety or CostActivity.
  • item_id
    The Agworld global identifier for the activity input.
  • item_supplier_name
    The name of the company that supplied the product.
  • item_national_registration_number
    The national identification number for registered inputs.
  • amount
    The scalar value of the input rate.
  • amount_unit
    The units that the input rate is expressed in terms of.
  • area
    The scalar value of the activity area.
  • area_unit
    The units that the activity area is expressed in terms of.
  • input_tags
    The tags that have been applied to the activity input.

Relationships

  • grower
    Links to the associated grower for this event.
  • farm
    Links to the associated farm for this event.
  • field
    Links to the associated field for this event.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "AIID10000APID10000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/8a134847-8aed-4574-9202-7f48f1b3cf13",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-05T16:00:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Bones",
        "type": "Product",
        "item_id": "PRO9000AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 800.0,
        "amount_unit": "kg",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": [
          "also only four"
        ]
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID10000APID10000AID50000"
      }
    },
    {
      "id": "AIID10000APID20000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/8a134847-8aed-4574-9202-7f48f1b3cf13",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-05T16:00:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Bones",
        "type": "Product",
        "item_id": "PRO9000AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1200.0,
        "amount_unit": "kg",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": [
          "also only four"
        ]
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID10000APID20000AID50000"
      }
    },
    {
      "id": "AIID20000APID10000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/8a134847-8aed-4574-9202-7f48f1b3cf13",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-05T16:00:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Water",
        "type": "Product",
        "item_id": "PRO4949AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1000.0,
        "amount_unit": "L",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID20000APID10000AID50000"
      }
    },
    {
      "id": "AIID20000APID20000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/8a134847-8aed-4574-9202-7f48f1b3cf13",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-05T16:00:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Water",
        "type": "Product",
        "item_id": "PRO4949AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1500.0,
        "amount_unit": "L",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID20000APID20000AID50000"
      }
    },
    {
      "id": "AIID30000APID10000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/8a134847-8aed-4574-9202-7f48f1b3cf13",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-05T16:00:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Paramondas",
        "type": "CropVariety",
        "item_id": "CRP7989AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 400.0,
        "amount_unit": "kg",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID30000APID10000AID50000"
      }
    },
    {
      "id": "AIID30000APID20000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/8a134847-8aed-4574-9202-7f48f1b3cf13",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-05T16:00:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Paramondas",
        "type": "CropVariety",
        "item_id": "CRP7989AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 600.0,
        "amount_unit": "kg",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID30000APID20000AID50000"
      }
    },
    {
      "id": "AIID50000APID10000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/8a134847-8aed-4574-9202-7f48f1b3cf13",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-05T16:00:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Soylent",
        "type": "CostActivity",
        "item_id": "CST7373AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 400.0,
        "amount_unit": "L",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID50000APID10000AID50000"
      }
    },
    {
      "id": "AIID50000APID20000AID50000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 50000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/8a134847-8aed-4574-9202-7f48f1b3cf13",
          "job_stage": "ActualActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": true,
        "event_date": "2011-06-05T16:00:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Soylent",
        "type": "CostActivity",
        "item_id": "CST7373AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 600.0,
        "amount_unit": "L",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID50000APID20000AID50000"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=true&filter%5Bevent_date%5D%5Bbefore%5D=2011-06-15+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=true&filter%5Bevent_date%5D%5Bbefore%5D=2011-06-15+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=true&filter%5Bevent_date%5D%5Bbefore%5D=2011-06-15+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Fetch stock item events for activities due after a specified event date

Endpoint

GET api/stock_item_events

Parameters

  • filter[grower_id]
    Filter results by one or more (comma-separated) grower ids. For performance reasons, this filter is recommended.
  • filter[completed]
    Filter result by whether or not the associated activities have been completed.
  • filter[event_date]
    Filter result by the event date (can specify [before] or [after]).
  • filter[field_id]
    Filter results by one or more (comma-separated) field ids.
  • filter[activity_id]
    Filter results by one or more (comma-separated) activity ids.
  • filter[activity_tag]
    Filter by one or more (comma-separated) tags at the activity level (case insensitive).
  • filter[input_tag]
    Filter by one or more (comma-separated) tags at the activity input level (case insensitive).
  • filter[job_stage]
    Filter by a job stage: ‘PlannedActivity’, ‘RecommendedActivity’, ‘WorkOrder’ or ‘ActualActivity’.
  • filter[updated_at]
    Filter results by the date that the associated activity was last updated (can specify [before] or [after]).

Request

Route

GET api/stock_item_events?filter[completed]=false&filter[event_date][after]=2011-06-29+10%3A30

Headers

Authorization: Bearer <token>

Query Parameters

filter={"completed"=>"false", "event_date"=>{"after"=>"2011-06-29 10:30"}}

Response

Simulated Response

Response Fields

  • activity_data
    Contains a JSON object containing values for the associated activity.
  • completed
    Indicates if the associated activity has been completed. Will be either true or false.
  • event_date
    The date the associated activity was completed or is due to complete.
  • updated_at
    The date that the associated activity was last updated.
  • created_at
    The date the associated activity was created.
  • name
    Name of product or crop variety.
  • type
    Type of the stock item. Will be either Product, CropVariety or CostActivity.
  • item_id
    The Agworld global identifier for the activity input.
  • item_supplier_name
    The name of the company that supplied the product.
  • item_national_registration_number
    The national identification number for registered inputs.
  • amount
    The scalar value of the input rate.
  • amount_unit
    The units that the input rate is expressed in terms of.
  • area
    The scalar value of the activity area.
  • area_unit
    The units that the activity area is expressed in terms of.
  • input_tags
    The tags that have been applied to the activity input.

Relationships

  • grower
    Links to the associated grower for this event.
  • farm
    Links to the associated farm for this event.
  • field
    Links to the associated field for this event.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "AIID10500APID10500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/5cfffc51-9d09-435d-b110-20aa0e343dfd",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-07-06T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Bones",
        "type": "Product",
        "item_id": "PRO9000AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 800.0,
        "amount_unit": "kg",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID10500APID10500AID60000"
      }
    },
    {
      "id": "AIID10500APID20500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/5cfffc51-9d09-435d-b110-20aa0e343dfd",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-07-06T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Bones",
        "type": "Product",
        "item_id": "PRO9000AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1200.0,
        "amount_unit": "kg",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID10500APID20500AID60000"
      }
    },
    {
      "id": "AIID20500APID10500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/5cfffc51-9d09-435d-b110-20aa0e343dfd",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-07-06T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Water",
        "type": "Product",
        "item_id": "PRO4949AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1000.0,
        "amount_unit": "L",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": [
          "also only four"
        ]
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID20500APID10500AID60000"
      }
    },
    {
      "id": "AIID20500APID20500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/5cfffc51-9d09-435d-b110-20aa0e343dfd",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-07-06T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Water",
        "type": "Product",
        "item_id": "PRO4949AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1500.0,
        "amount_unit": "L",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": [
          "also only four"
        ]
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID20500APID20500AID60000"
      }
    },
    {
      "id": "AIID30500APID10500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/5cfffc51-9d09-435d-b110-20aa0e343dfd",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-07-06T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Paramondas",
        "type": "CropVariety",
        "item_id": "CRP7989AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 400.0,
        "amount_unit": "kg",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID30500APID10500AID60000"
      }
    },
    {
      "id": "AIID30500APID20500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/5cfffc51-9d09-435d-b110-20aa0e343dfd",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-07-06T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Paramondas",
        "type": "CropVariety",
        "item_id": "CRP7989AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 600.0,
        "amount_unit": "kg",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID30500APID20500AID60000"
      }
    },
    {
      "id": "AIID50500APID10500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/5cfffc51-9d09-435d-b110-20aa0e343dfd",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-07-06T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Soylent",
        "type": "CostActivity",
        "item_id": "CST7373AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 400.0,
        "amount_unit": "L",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID50500APID10500AID60000"
      }
    },
    {
      "id": "AIID50500APID20500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/5cfffc51-9d09-435d-b110-20aa0e343dfd",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-07-06T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Soylent",
        "type": "CostActivity",
        "item_id": "CST7373AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 600.0,
        "amount_unit": "L",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID50500APID20500AID60000"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=false&filter%5Bevent_date%5D%5Bafter%5D=2011-06-29+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=false&filter%5Bevent_date%5D%5Bafter%5D=2011-06-29+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=false&filter%5Bevent_date%5D%5Bafter%5D=2011-06-29+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}

Fetch stock item events for activities due before a specified event date

Endpoint

GET api/stock_item_events

Parameters

  • filter[grower_id]
    Filter results by one or more (comma-separated) grower ids. For performance reasons, this filter is recommended.
  • filter[completed]
    Filter result by whether or not the associated activities have been completed.
  • filter[event_date]
    Filter result by the event date (can specify [before] or [after]).
  • filter[field_id]
    Filter results by one or more (comma-separated) field ids.
  • filter[activity_id]
    Filter results by one or more (comma-separated) activity ids.
  • filter[activity_tag]
    Filter by one or more (comma-separated) tags at the activity level (case insensitive).
  • filter[input_tag]
    Filter by one or more (comma-separated) tags at the activity input level (case insensitive).
  • filter[job_stage]
    Filter by a job stage: ‘PlannedActivity’, ‘RecommendedActivity’, ‘WorkOrder’ or ‘ActualActivity’.
  • filter[updated_at]
    Filter results by the date that the associated activity was last updated (can specify [before] or [after]).

Request

Route

GET api/stock_item_events?filter[completed]=false&filter[event_date][before]=2011-06-29+10%3A30

Headers

Authorization: Bearer <token>

Query Parameters

filter={"completed"=>"false", "event_date"=>{"before"=>"2011-06-29 10:30"}}

Response

Simulated Response

Response Fields

  • activity_data
    Contains a JSON object containing values for the associated activity.
  • completed
    Indicates if the associated activity has been completed. Will be either true or false.
  • event_date
    The date the associated activity was completed or is due to complete.
  • updated_at
    The date that the associated activity was last updated.
  • created_at
    The date the associated activity was created.
  • name
    Name of product or crop variety.
  • type
    Type of the stock item. Will be either Product, CropVariety or CostActivity.
  • item_id
    The Agworld global identifier for the activity input.
  • item_supplier_name
    The name of the company that supplied the product.
  • item_national_registration_number
    The national identification number for registered inputs.
  • amount
    The scalar value of the input rate.
  • amount_unit
    The units that the input rate is expressed in terms of.
  • area
    The scalar value of the activity area.
  • area_unit
    The units that the activity area is expressed in terms of.
  • input_tags
    The tags that have been applied to the activity input.

Relationships

  • grower
    Links to the associated grower for this event.
  • farm
    Links to the associated farm for this event.
  • field
    Links to the associated field for this event.

Status

200

Headers

Content-Type: application/vnd.api+json; charset=utf-8

Body

{
  "data": [
    {
      "id": "AIID10500APID10500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/9c50b01c-2fa0-4b67-96d8-40015aefb1a2",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Bones",
        "type": "Product",
        "item_id": "PRO9000AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 800.0,
        "amount_unit": "kg",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID10500APID10500AID60000"
      }
    },
    {
      "id": "AIID10500APID20500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/9c50b01c-2fa0-4b67-96d8-40015aefb1a2",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Bones",
        "type": "Product",
        "item_id": "PRO9000AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1200.0,
        "amount_unit": "kg",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID10500APID20500AID60000"
      }
    },
    {
      "id": "AIID20500APID10500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/9c50b01c-2fa0-4b67-96d8-40015aefb1a2",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Water",
        "type": "Product",
        "item_id": "PRO4949AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1000.0,
        "amount_unit": "L",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": [
          "also only four"
        ]
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID20500APID10500AID60000"
      }
    },
    {
      "id": "AIID20500APID20500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/9c50b01c-2fa0-4b67-96d8-40015aefb1a2",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Water",
        "type": "Product",
        "item_id": "PRO4949AU",
        "item_supplier_name": "Dave's Farm Supplies",
        "item_national_registration_number": null,
        "amount": 1500.0,
        "amount_unit": "L",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": [
          "also only four"
        ]
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID20500APID20500AID60000"
      }
    },
    {
      "id": "AIID30500APID10500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/9c50b01c-2fa0-4b67-96d8-40015aefb1a2",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Paramondas",
        "type": "CropVariety",
        "item_id": "CRP7989AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 400.0,
        "amount_unit": "kg",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID30500APID10500AID60000"
      }
    },
    {
      "id": "AIID30500APID20500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/9c50b01c-2fa0-4b67-96d8-40015aefb1a2",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Paramondas",
        "type": "CropVariety",
        "item_id": "CRP7989AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 600.0,
        "amount_unit": "kg",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID30500APID20500AID60000"
      }
    },
    {
      "id": "AIID50500APID10500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/9c50b01c-2fa0-4b67-96d8-40015aefb1a2",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Soylent",
        "type": "CostActivity",
        "item_id": "CST7373AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 400.0,
        "amount_unit": "L",
        "area": 40.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100120"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID50500APID10500AID60000"
      }
    },
    {
      "id": "AIID50500APID20500AID60000",
      "type": "stock_item_events",
      "attributes": {
        "activity_data": {
          "id": 60000,
          "name": null,
          "pdf": "http://localhost:3000/activities/current_pdf/9c50b01c-2fa0-4b67-96d8-40015aefb1a2",
          "job_stage": "PlannedActivity",
          "activity_tags": [
            "should only exist 2"
          ]
        },
        "completed": false,
        "event_date": "2011-06-22T02:30:00+00:00",
        "updated_at": "2011-06-15T02:30:00+00:00",
        "created_at": "2011-06-15T02:30:00+00:00",
        "name": "Soylent",
        "type": "CostActivity",
        "item_id": "CST7373AU",
        "item_supplier_name": null,
        "item_national_registration_number": null,
        "amount": 600.0,
        "amount_unit": "L",
        "area": 60.0,
        "area_unit": "ha",
        "input_tags": []
      },
      "relationships": {
        "grower": {
          "links": {
            "related": "http://localhost:3000/api/growers/100000"
          }
        },
        "farm": {
          "links": {
            "related": "http://localhost:3000/api/farms/100100"
          }
        },
        "field": {
          "links": {
            "related": "http://localhost:3000/api/fields/100121"
          }
        }
      },
      "links": {
        "self": "http://localhost:3000/api/stock_item_events/AIID50500APID20500AID60000"
      }
    }
  ],
  "links": {
    "self": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=false&filter%5Bevent_date%5D%5Bbefore%5D=2011-06-29+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "first": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=false&filter%5Bevent_date%5D%5Bbefore%5D=2011-06-29+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true",
    "last": "http://localhost:3000/api/stock_item_events?filter%5Bcompleted%5D=false&filter%5Bevent_date%5D%5Bbefore%5D=2011-06-29+10%3A30&page%5Bnumber%5D=1&page%5Bsize%5D=20&pagination_links=true"
  },
  "meta": {}
}