Calling an endpoint
There are three ways of calling a custom endpoint in Curiosity Workspace: one from within the user interface, one from within a data connector, and finally one for external callers.
From within the user interface
The first way is to use the endpoint API that is provided as part of the Curiosity front-end package, which takes care of configuring the HTTP request, data serialization, authorization and the asynchronous endpoint processing logic.
Existing endpoints can be invoked from front-end code using the following syntax:
From data connectors
The data connector package provides a helper class that wraps the logic of calling an endpoint for you. You can use this class as following:
From outside the workspace
The final way is to use any HTTP client or tool that can send requests over HTTPS, such as curl or Postman. In this case you'll need to generate a valid endpoint token, and you need to provide it as a Bearer token in the Authentication header. For example, you can call an endpoint using curl:
When calling an endpoint, you must check the Status Code of the response, as endpoints run asynchronously by default, and will return 202 Accepted if the call was received but the result is not yet available. If you receive a 202 response, you should call again the same endpoint with the exact same request (i.e. same body) until you receive a 200 (in case of success) or 500 (in case of failure) response.
When you call an endpoint from the front-end or the connector, the helper methods will take care of this retry logic for you
Last updated