Agrigate developer documentation
Welcome to the Agrigate developer portal. Here you will find reference documentation for our public APIs. Use the tabs above to select an API or continue reading for information on getting started.
What is Agrigate?
Duplication of data entry is a major headache for farmers, and a barrier to technology adoption. Agrigate enables easy and secure data sharing between on farm apps, helping you deliver a better user experience for your customers, and giving farmers confidence that they can send their data where it needs to go.
API selection
Agrigate offers several APIs for distinct data sets such as Milk Quality or Animal Health. Each API is secured by a common OAuth2 protocol, described in the OAuth2 API documentation.
Connecting your application
This diagram shows the relationship between your Data Partner API, the Agrigate web site, and Agrigate APIs.
1) User connection
When the user selects Connect
in the Data Partner’s section of the Agrigate web application (client), a link to the Data Partner’s authorization server is prepared.
Client ID (supplied by the Data Partner)
This is included in the link that allows the authorization server to identify and respond to Agrigate.
Data Partner’s Authorization Server
Typically, this endpoint is published on your server as: /oauth/authorize
.
2) Authorization
The link is opened in the browser and the user enters the credentials for their account with the Data Partner.
Authorization Code
The authorization server returns an authorization code via redirection i.e. returns the user back to the Agrigate website. The redirect URL for Agrigate is: https://{environment}.agrigate.co.nz/oauthredirect/{dataprovider-slug}
Data Partner’s Authorization Server
Typically, this endpoint is published as: /oauth/token
.
3) Access token
Agrigate then exchanges the Authorization Code along with providing its Client Id and Client Secret (both supplied by the Data Partner) for an Access Token (short-lived <60mins) and a Refresh Token (long-lived ~90 days).
Access Token
Agrigate uses the Access Token to access resources on the Data Partner’s resource server. i.e. call the Data Partner’s API to retrieve the user’s data.
Bearer token
Pass your access token to APIs using the Authorization
header with the Bearer <token>
format.