Skip to content

Latest commit

 

History

History
92 lines (81 loc) · 2.14 KB

api.md

File metadata and controls

92 lines (81 loc) · 2.14 KB

API


GET alive?

The runtime liveness probe to see if the service is alive.

  • parameters
    • none
  • returns (JSON-out)
    • true
  • example
    $ curl --silent -X GET https://${IP_ADDRESS}:${PORT}/alive?
    
    {"alive?":true}

GET ready?

The runtime readiness probe to see if the service is ready to handle requests.

  • parameters
    • none
  • returns (JSON-out)
    • true if the service is ready
    • false if the service is not ready
  • example
    $ curl --silent -X GET https://${IP_ADDRESS}:${PORT}/ready?
    
    {"ready?":false}

GET sha

The git commit sha used to create the Docker image.

  • parameters
    • none
  • returns (JSON-out)
    • the 40 character commit sha string.
  • example
    $ curl --silent -X GET https://${IP_ADDRESS}:${PORT}/sha
    
    {"sha":"41d7e6068ab75716e4c7b9262a3a44323b4d1448"}

GET base-image

The base-image used in the Dockerfile's FROM statement.

  • parameters
    • none
  • result
    • the name of the base image.
  • example
    $ curl --fail --silent --request GET https://${DOMAIN}:${PORT}/base_image
    {"base_image":"cyberdojo/sinatra-base:edb2887"}

JSON in

  • All methods pass any arguments as a json hash in the http request body.
  • If there are no arguments you can use '' (which is the default for curl --data) instead of '{}'.

JSON out

  • All methods return a json hash in the http response body.
  • If the method completes, a string key equals the method's name. eg
    $ curl --silent -X GET https://${IP_ADDRESS}:${PORT}/ready?
    
    {"ready?":true}
  • If the method raises an exception, a string key equals "exception", with a json-hash as its value. eg
    $ curl --silent -X POST https://${IP_ADDRESS}:${PORT}/group_create_custom | jq      
    
    {
      "exception": {
        "path": "/group_create_custom",
        "body": "",
        "class": "CreatorService",
        "message": "...",
        "backtrace": [
          ...
          "/usr/bin/rackup:23:in `<main>'"
        ]
      }
    }