Overview
IFSNP exposes a GraphQL API at /q with an interactive GraphiQL browser interface. The API provides read access to most data modules and full authentication mutations.
Authentication
The API uses JSON Web Tokens (JWT). Obtain a token using the tokenAuth mutation:
mutation {
tokenAuth(email: "user@example.com", password: "password") {
token
}
}
Include the token in subsequent requests as a header:
Authorization: JWT <your-token>
Note: JWT tokens are configured to never expire in this system.
Available Queries
The GraphQL schema includes queries for: regions, accounts, rainfall, temperature, NDVI, rangeland, cropland, water, malnutrition, prices, displacement, economy, AFI, and crop yield.
REST API
A token-based REST API is also available at /api-token-auth/ using Django REST Framework. Obtain a token with a POST request containing username and password credentials.