Consuming the RESTful API from a Custom Application

The REST API provided by the REST plug-in allows you to send requests to the vision system and to query information from the vision system. This is done via HTTP endpoints that are composed of a predefined (base) URL and an HTTP method. You can build an application customized to your use case and send requests to the available endpoints to query information from the vision system and to control it by triggering actions.

The REST API provides two different types of HTTP methods: GET and POST. GET methods are used to query information from the vision system, for example, to get a list of available recipes or to get the results of an execution. POST methods are used to trigger a specific action such as preparing a recipe or to start an execution.

The section below shows which endpoints are provided by the REST API and for what purpose each of the endpoints can be used. In summary, they can be used for the following purposes:

  • Getting the system status and sending actions to the vision system.
  • Preparing and unpreparing recipes.
  • Starting running jobs, that is, a single or continuous execution.
  • Getting information about the recipes, running jobs, events, and errors.
  • Getting the results.

Available Endpoints

The following table gives an overview of the available endpoints of the REST API and thus an overview of the API storage semantics of the resources.

URI

HTTP method

Description

/state_machine

GET

Returns the current status of the system.

/state_machine/actions

POST

Sends an action to the vision system.

/state_machine/actions/{action_id}/status

GET

Returns the status of the specified action.

/recipes

GET

Returns a list of available recipes.

/recipes/actions

POST

Sends an action for a specific recipe.

/recipes/actions/{action_id}/status

GET

Returns the status of the given action for a specific recipe.

/jobs

GET

Returns a list of all known jobs in reverse chronological order.

/jobs/{job_id}

GET

Returns information about an explicit job for a specific recipe.

/recipes/{recipe_id}/jobs

GET

Returns a list of all jobs started for a specific recipe in reverse chronological order.

/events

GET

Returns a list of events in reverse chronological order.

/events/{event_id}

GET

Returns information about a specific event.

/results

GET

Returns a list of results in reverse chronological order.

/recipes/{recipe_id}/results

GET

Returns a list of results of a specific recipe in reverse chronological order.

/jobs/{job_id}/results

GET

Returns a list of results associated to a job in reverse chronological order.

/errors

GET

Returns a list of errors in reverse chronological order.

/errors/{error_id}

GET

Returns error information for a specific error ID.

For more information on the REST API and the available endpoints, see the documentation of the REST API which can be accessed in the built-in web application via the "API Docs" menu entry.