AgriWebb API
API Reference

GraphQL

POST /v2

We expose a GraphQL Playground where you can experiment with our GraphQL API to query and mutate data. You will need to provide an Authorization header in JSON format under the HTTP HEADERS section at the bottom of the page.

For example:

  {
    "Authorization": "Bearer ..."
  }

The GraphQL schemas, queries, and mutations are documented in the GraphQL section of our documentation.

Common API calls

Geo coordinate order

The GraphQL API follows the GeoGSON standard for all coordinates and geometries. GeoJSON uses longitude,latitude ordering for coordinates which is the reverse from a lot of tools, there is a nice discussion of that inconsistency here: https://macwright.com/lonlat/

A common issue is that landmarks created via the api are not visible on the farm map, but this is often because they are created with a lat,long order and are thus off in the ocean or in space. This mutation will create a rain gauge on the Sydney Opera House at longitude: 151.2152967, latitude: -33.8567844

  mutation($farmId: ID!) {
    addMapFeatures(input:{
      name: "Opera house"
      geometry: {
        type: Point
        coordinates: [151.2152967, -33.8567844]
      }
      farmId: $farmId
      type: RAIN_GAUGE
    }) {
      mapFeatures {
        id
      }
    }
  }

Accessing animal records

Animal history is built up by a series of records. The GraphQL API exposes these as a polymorphic type which can be accessed using inline fragments like this:

  query($farmId: String!, $animalId: String!) {
    animals(
      farmId: $farmId
      filter: {
        animalId: { _eq: $animalId }
      }
    ) {
      animalId
      records {
        recordId
        recordType
        ... on WeighRecord {
          weight {
            unit
            value
          }
        }
        ... on ScoreRecord {
          score {
            unit
            value
          }
        }
      }
    }
  }
POST
/v2

Header Parameters

Authorizationstring

The only supported authorisation method is Basic ...

querystring
operationName?string
variables?object

Empty Object

Response Body

curl -X POST "https://api.agriwebb.com/v2" \
  -H "Authorization: string" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "string"
  }'
{
  "data": null,
  "errors": [
    null
  ],
  "error": null
}
{
  "data": null,
  "errors": [
    null
  ],
  "error": null
}
{
  "data": null,
  "errors": [
    null
  ],
  "error": null
}
{
  "data": null,
  "errors": [
    null
  ],
  "error": null
}