Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Hobson Hub makes There is a comprehensive REST API available for the Hobson Hub available . That API documentation is in Swagger format. The Swagger UI makes it extremely easy to browse the endpoints, see request/response examples and even authenticate and invoke API endpoints directly.

Public

The latest API version in Swagger format is publicly available here:

http://hobson-automation.com/apidoc/api

Authentication

Obtaining a Token

In order to use any secure REST API resources, you need a valid bearer token. This is generated by the Login User resource. You will find a "token" attribute in the JSON response after a successful login call. The returned token is a standard JSON Web Token (JWT) and will look something like this:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0b3B0YWwuY29tIiwiZXhwIjoxNDI2NDIwODAwLCJodHRwOi8vdG9wdGFsLmNvbS9qd3RfY2xhaW1zL2lzX2FkbWluIjp0cnVlLCJjb21wYW55IjoiVG9wdGFsIiwiYXdlc29tZSI6dHJ1ZX0.yRQYnWzskCZUxPwaQupWkiUzKELZ49eM7oWxAQK_ZXw

Using a Token

You must pass a valid token to all secure REST API resources or you will get a 401 error response. To do that, add the HTTP Authorization header with the Bearer schema in your API request. For example:

Authorization: Bearer <token>

...

Local

The documentation link above describes the latest public version of the Hobson Hub REST API. Additionally, the Hobson Hub publishes a Swagger documentation endpoint which will always be appropriate for the version of the Hub being run.

The local endpoint for this (assuming the Hobson Hub is available at "localhost") is:

http://localhost:8182/api/v1/swagger.json

An easy way to browse and invoke the local Hub API is to navigate to the public link, enter the local endpoint in the text field in the upper-right and click the "Explore" button. This will load the API definition from the local Hub and allow you to authenticate and invoke API endpoints right from within the Swagger UI.