Skip to content

Input and Output Specifications

ardeearam edited this page Oct 29, 2014 · 1 revision

Input Specifications

HTTP Verb Convention

  • GET - an idempotent operation to retreive data from the API.
  • POST - create a new record in the API.
  • PUT - modify an existing record in the API.
  • DELETE - remove a record from the API.

HTTP Headers

  • Accept - must be application/json
  • Authorization - your Authorization String. How to get my Authorization string?
  • Content-Type - for requests with data payload, this should be application/json. This is optional for requests with no data payload.

Data Payload

The data parameter object is placed at the body of the HTTP meessage, and must JSON-encoded. The actual structure of the data parameter object depends on the needs of the API method.

Output Specifications

The output of the GCORE API is a JSON-encoded object, with at least the following attributes: message - a human-readable string that says something about the result of the preceding operation. model - the object payload of the preceding operation. This may or may not be present in the response. The object payload may be composed of a single object, or an array of objects.

HTTP Codes

GCORE API uses a subset of the HTTP response codes.

  • 200 - the operation was successfully accomplished, with no errors.
  • 401 - the user has not yet logged in.
  • 403 - the user has logged in, but has no authorization to do the operation.
  • 404 - the API method being called does not exist.
  • 500 - an error happened while processing the operation.
  • 501 - there are future plans to have this API method, but it has not yet implemented.

HTTP Headers

Below are some of the headers being returned by the GCore API. Each API resource may add additional headers.

  • Content-Type - Always application/json; charset=utf-8. Your client should then be able to parse the JSON output properly.
  • X-GCore-Version - The current version of the GCore API.
  • Access-Control-Allow-Origin - Current value is *, indicating that the GCore API supports Cross Origin Resource Sharing (CORS), allowing JavaScript code to call the GCore API via AJAX.

Data Payload

As with the input, the output is also a JSON-encoded string.