Chorus provides a robust API, supported by Third Light, and designed with long term stability in mind. The API is provided via two separate interfaces: a RESTful HTTP interface, and a gRPC endpoint supported by a set of protocol buffer definitions. Both interfaces provide identical functionality, leaving the choice of which to use down to the coding task in hand.
The methods available in the Chorus REST API are documented in /apidocs.html under your instance. For example, if your Chorus instance has the address then you can find the API documentation under
REST interface (including Swagger) - recommended for most users
The REST interface provides simple access to all the API features, using standard HTTP semantics and JSON encoded request and response data. The REST interface is best suited to projects written for the browser, for experimental or simple projects, or simply for exploring API functionality. Requests are made using standard HTTP methods such as GET, POST, and PATCH. Request and response data is encoded using JSON.
For example, to retrieve the current environment for your Chorus site, here is a simple cURL command example:
Requests are sent using HTTPS libraries to this endpoint.
The interface can be explored using a built in Swagger UI implementation. Please visit /apidocs/swaggerui/ in your browser.
Swagger provides a great way to explore the API; you can create and test API requests in an interactive user interface that's built into Chorus, significantly reducing the time and effort needed to test and develop new code. The recommended way to use the Swagger UI is as follows.
Step 1: Click the /rest/v1/auth/login method (the description of the method will expand).
Step 2: Click on "Try it out" method:
Step 3: Update the username and password fields in the JSON body box, then click the "Execute" button (under the body box).
Step 4: Scroll down to the server response to obtain the sessionId from the response body box:
Step 5: Go back to the top of the documentation page and click the green "Authorize" button:
Step 6: Copy the session you obtained in Step 1 into the box:
Lastly, click "Authorize".
This completes the process for authenticating Swagger. All subsequent queries made inside the Swagger documentation for the Chorus REST API will now use the session automatically, and methods that need a sessionId will now been unlocked.
REST Authentication (details)
Authentication is achieved by retrieving a sessionId from one of the login methods, either auth/login or auth/loginWithKey (for API keys), and then providing that value with each subsequent request.
You should obtain a sessionId and then re-use that sessionId for subsequent requests to the API. The REST interface requires the session ID to be passed in an X-Chorus-Session HTTP header.
For example, to obtain a sessionId:
The sessionId has been provided in the response (TsVYymyYvhdz3wYPB-6D-6ARrtGvCG3o).
We can now use it in subsequent API requests in the X-Chorus-Session header. In this example, we ask Chorus to provide the context for the session:
The gRPC interface allows access to the API using an industry standard RPC framework.
Third party support for a wide variety of languages is available, allowing developers to use their language of choice. If you are new to gRPC, the quick start guide is a good starting point.
The gRPC interface in Chorus is formally documented.
The methods available in the Chorus gRPC API are documented in /apidocs/grpc/ under your instance. For example, if your Chorus instance has the addressthen you can find the API documentation under
gRPC Protocol Buffer Definitions
A set of protocol buffer definitions is available, which can be used to generate client bindings for languages supported by gRPC. The protocol buffers are documented under /apidocs/grpc/definitions/.
In gRPC, the gRPC server requires the session token to be provided as session.with a key of