Loading API libraries...

ABC GymSales is a fully hosted lead management system for the fitness industry. We provide a REST API built on pragmatic RESTful design principles.

Our API uses resource-oriented URLs that leverage built in features of HTTP, like authentication, verbs and response codes. All request and response bodies are JSON encoded, including error responses. Any off-the-shelf HTTP client can be used to communicate with the API.

We believe an API is a user interface for a developer - accordingly, we've made sure our API can be easily explored from the browser!
 

JSON Bodies

All POSTPUT requests are JSON encoded and must have have content type of application/x-www-form-urlencoded or application/json, or the API will return a 415 Unsupported Media Type status code.

$ curl -u email:password https://login.gymsales.net/api/v1/users/12345 \
    -X PUT \
    -H 'Content-Type: application/json' \
    -d '{"first_name":"John"}'

HTTP Verbs

We use standard HTTP verbs to indicate intent of a request:

  • GET - To retrieve a resource or a collection of resources
  • POST - To create a resource
  • PUT - To modify a resource
  • DELETE - To delete a resource

Limited HTTP Clients

If you are using an HTTP client that doesn't support PUTPATCH or DELETE requests, send a POSTrequest with an X-HTTP-Method-Override header specifying the desired verb.

$ curl -u email:password https://login.gymsales.net/api/v1/users/1234 \
    -X POST \
    -H "X-HTTP-Method-Override: DELETE"

Responses

All response bodies are JSON encoded.

A single resource is represented as a JSON object:

{
  "field1": "value",
  "field2": true,
  "field3": []
}

A collection of resources is represented as a JSON array of objects named collection and a pagination object with total pages and total entries fields:

{
  "collection": [
    {
      "field1": "value",
      "field2": true,
      "field3": []
    },
    {
      "field1": "another value",
      "field2": false,
      "field3": []
    }
  ],
  "pagination": {
    "total_pages": 1,
    "total_entries": 2
  }
}

Timestamps are in company time zone and formatted as ISO8601.

Unset fields will be represented as a null instead of not being present. If the field is an array, it will be represented as an empty array - ie [].

HTTP Status Codes

We use HTTP status codes to indicate success or failure of a request.

Success codes:

  • 200 OK - Request succeeded. Response included
  • 201 Created - Resource created. URL to new resource in Location header
  • 204 No Content - Request succeeded, but no response body

Error codes:

  • 400 Bad Request - Could not parse request
  • 401 Unauthorized - No authentication credentials provided or authentication failed
  • 403 Forbidden - Authenticated user does not have access
  • 404 Not Found - Resource not found
  • 415 Unsupported Media Type - POST/PUT/PATCH request occurred without a application/jsoncontent type
  • 422 Unprocessable Entity - A request to modify or create a resource failed due to a validation error
  • 429 Request Limit Exceeded - you have exceeded your GymSales API request limit. This occurs when you make more than 500 API requests per minute
  • 500, 501, 502, 503, etc - An internal server error occured

 


[QA/Staging] version 1.0.0 (released on 2015-08-17 13:31:26 UTC)
Release note: GymSales API
Loading release history...