API into your Farm!
You can do all sorts of cool things using The Coop APIs.
Action | URL | Method | Sandbox |
---|---|---|---|
Retrieves user that's tied to the access token | /api/me | GET | |
Unlock the Barn | /api/USER_ID/barn-unlock | POST | try it |
Put the Toilet Seat Down | /api/USER_ID/toiletseat-down | POST | try it |
Feed Your Chickens | /api/USER_ID/chickens-feed | POST | try it |
Collect Eggs from Your Chickens | /api/USER_ID/eggs-collect | POST | try it |
Get the Number of Eggs Collected Today | /api/USER_ID/eggs-count | POST | try it |
Success Response
{ "action": "The action (e.g. \"barn-unlock\")", "success": true, "message": "Some summary message", "data": "A raw, related piece of data if applicable" }
Error Response
{ "error": "A key (e.g. access_denied) for the error", "error_description": "A longer description of the error" }
Authentication via OAuth
COOP's API uses OAuth for authentication and supports the following grant types:
- Client Credentials
- Authorization Code
Here are the important endpoints and their parameters
URL | Description |
---|---|
POST /token |
The endpoint used for requesting an access token, using either the authorization_code or client_credentials grant type.
http://coop.apps.symfonycasts.com/token
This accepts the following POST fields:
|
GET /authorize |
When using the authorization code (traditional "web") grant type, start by redirecting the user to this URL:
http://coop.apps.symfonycasts.com/authorize
This accepts the following GET parameters
Once the user is redirected back to |
Authorizing your API Requests
Once you have an access token, send it via the Authorization
header:
POST /collect-eggs HTTP/1.1 Host: coop.apps.symfonycasts.com Authorization: Bearer ACCESSTOKENHERE
Here is a list of your applications:
Well let's not waste any more time... Create your Application!