Glasshat Service API

Overview

The Glasshat API is a set of endpoints allowing user programs to manage projects and access the latest action recommendations provided by Glasshat's technology.

Requests

A user's program should send HTTP requests to Glasshat's 17 API endpoints via either the GET or POST methods.

GET request

  • Get requests are for endpoints that only query information, like/account/0/clients.
  • The parameters can be specified in URL query string.
  • The endpoints that identify specific items need to have the item ID specified in the endpoint path. For example: /task/{task_id}/get.

POST request

  • Post requests are for endpoints that modify data, like /task/{task_id}/update.
  • Like with GET requests, identification of specific items is done using a data item ID, specified in the path.
  • With Post requests, parameters can be specified:
    • in URL query string
    • as form variable (Content-Type application/x-www-form-urlencoded)
    • or as JSON object (Content-Type: application/json). Please note, if a parameter is given in a query string or as form variable, and the parameter value itself is a JSON object, then the value must be serialised into a unquoted string.

Common Request Parameters

apikey (String) API licence key provided by Glasshat

All requests are stateless, i.e. there is no login session. Every request must provide the 32-character license key issued by Glasshat.

Responses

All endpoints return a JSON object Content-Type: application/json.

Code Description
200 OK.
400 Request parameters contain invalid data.
402 Account allowance exceeded. Contact Glasshat support to discuss upgrade options.
403 License key is invalid, expired or disabled.
404 Endpoint does not exist.
404 Item is not found.
409 Item to be created exists. Use a different name.
429 Too many requests for given Glasshat API licence key. Try again later.

Common Response Fields

The below is a JSON example of an error response:

{
  errors: (Object) One or more error names and error messages.
  {
    no_license: (String) API licence key invalid, expired or disabled. (HTTP 403)
    too_many_requests: (String) Rate limited, try again later. (HTTP 429)
    invalid_parameter: (String) Request parameters contain errors. (HTTP 400)
    too_many_items: (String) Account allowance exceeded. Upgrade to higher price package. (HTTP 402)
    client_exists: (String) Client name exists in the account. (HTTP 409)
    project_exists: (String) Project name exists in the client. (HTTP 409)
    no_client: (String) Client ID not found. (HTTP 404)
    no_project: (String) Project ID not found. (HTTP 404)
    no_task: (String) Action ID not found. (HTTP 404)
  }
}