Securely authenticate with the Field Nation API using OAuth 2.0.
The Field Nation API uses OAuth 2.0 for authentication. You must exchange your credentials for an access token, which is then included in the header of every API request.
Obtain your client_id, client_secret, username, and password from your Field Nation representative or integration settings.
Make a POST request to the token endpoint to exchange your credentials for a bearer token.
curl -X POST "https://api.fieldnation.com/authentication/api/oauth/token" \
-H "Content-Type: application/json" \
-d '{
"grant_type": "password",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"username": "YOUR_USERNAME",
"password": "YOUR_PASSWORD"
}'{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbG...",
"expires_in": 3600,
"token_type": "Bearer",
"scope": "basic",
"refresh_token": "cf83e1357eefb8bdf1542850d66d8007"
}Include the access_token in the Authorization header of your API requests.
curl -X GET "https://api.fieldnation.com/api/rest/v2/workorders/12345" \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG..."Token Expiration: Access tokens are valid for a limited time (usually 1 hour). When a token expires, use the refresh_token or re-authenticate to get a new one.
Common authentication errors you might encounter:
| Status Code | Message | Description |
|---|---|---|
401 | Unauthorized | The token is missing, invalid, or expired. |
403 | Forbidden | The token is valid, but the user does not have permission for this resource. |
Last updated on