-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #190 from quixio/tonybedford/sc-45562/reader-write…
…r-signalr-docs-need-updating Update Streaming Reader / Writer APIs section of docs
- Loading branch information
Showing
99 changed files
with
845 additions
and
772 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
## API reference guides | ||
|
||
An OAS3 API reference guides are available for HTTP/REST APIs. These are rendered using [Swagger](https://swagger.io/){target=_blank}. | ||
|
||
The URLs for the API references are specific to your environment, so you can easily test out API calls on your environment using the API reference. You'll need to [get you environment ID](../platform/how-to/get-environment-id.md). The exception to this is the Portal API, which is account-wide. | ||
|
||
| API | API reference URL (Swagger documentation)| | ||
|---|---| | ||
| Streaming Writer | https://writer-`<environment-id>`.platform.quix.ai/swagger | | ||
| Streaming Reader | No HTTP/REST interface - SignalR (WebSockets or Long Polling)| | ||
| Portal | https://portal-api.platform.quix.ai/swagger | | ||
| Query | https://telemetry-query-`<environment-id>`.platform.quix.ai/swagger | | ||
|
||
Replace `<environment-id>` with your [environment ID](../platform/how-to/get-environment-id.md). | ||
|
||
!!! tip | ||
|
||
Once you access the API reference, you can select the version of the API you require from the `Select a definition` dropdown list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# HTTP requests | ||
|
||
How you send HTTP requests REST APIs varies depending on the client or language you’re using. | ||
|
||
## Sign requests using your PAT | ||
|
||
Make sure you accompany each request to the API with an `Authorization` header using your [Personal Access Token (PAT)](../platform/how-to/personal-access-token-pat.md) as a bearer token, as follows: | ||
|
||
``` http | ||
Authorization: bearer <token> | ||
``` | ||
|
||
Replace `<token>` with your [Personal Access Token (PAT)](../platform/how-to/personal-access-token-pat.md). | ||
|
||
For example, if you’re using Curl on the command line, you can set the header using the `-H` flag: | ||
|
||
``` shell | ||
curl -H "Authorization: bearer <token>" ... | ||
``` | ||
|
||
If you fail to send a valid Authorization header, the API will respond with a `401 UNAUTHORIZED` status code. | ||
|
||
## Endpoint URLs | ||
|
||
APIs are available on a per-environment basis (with the exception of the Portal API), so the endpoint URL is based on your environment ID. | ||
|
||
Read the documentation on [how to obtain your environment ID](../platform/how-to/get-environment-id.md). | ||
|
||
The API endpoint URL has the following format: | ||
|
||
``` | ||
https://<api-name>-<environment-id>.platform.quix.ai/<action> | ||
``` | ||
|
||
So, for example, the endpoint URL for the streaming writer might resemble the following: | ||
|
||
``` | ||
https://writer-acme-weather.platform.quix.ai/<action> | ||
``` | ||
|
||
The API is `writer`, and the environment ID is `acme-weather`. | ||
|
||
## HTTP method | ||
|
||
Endpoints in the API use HTTP methods such as `POST` and `PUT` methods. Ensure your HTTP client sends the correct request method. | ||
|
||
Using `curl`, you can specify the request method with the `-X <POST|PUT>` flag, for example: | ||
|
||
```bash | ||
curl -X PUT ... | ||
``` | ||
|
||
## Payload | ||
|
||
For most methods, you’ll need to send a JSON object containing supported parameters. You’ll also need to set the appropriate content type for the payload you’re sending: | ||
|
||
```bash | ||
curl -H "Content-Type: application/json" ... | ||
``` | ||
|
||
!!! warning | ||
|
||
You **must** specify the content type of your payload. Failing to include this header will result in a `415 UNSUPPORTED MEDIA TYPE` status code. | ||
|
||
You can send data using the `curl` flag `-d`. This should be followed by either a string of JSON data, or a string starting with the *@* symbol, followed by a filename containing the JSON data. | ||
|
||
```bash | ||
curl -d '{"key": "value"}' ... | ||
curl -d "@data.json" ... | ||
``` | ||
|
||
!!! tip | ||
|
||
By default, `-d` will send a `POST` request, so `-X POST` becomes unnecessary. | ||
|
||
## Complete Curl example | ||
|
||
You should structure most of your requests to the API around this pattern: | ||
|
||
```bash | ||
curl -H "Authorization: bearer ${token}" \ | ||
-H "Content-Type: application/json" \ | ||
-d "@data.json" \ | ||
https://${api-name}-${environment-id}.platform.quix.ai/<action> | ||
``` |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Quix APIs | ||
|
||
The Quix Platform provides several APIs. These are: | ||
|
||
* Streaming Writer API | ||
* Streaming Reader API | ||
* Portal API | ||
* Query API | ||
|
||
While [Quix Streams](../client-library-intro.md) is the main client library for Quix, there are certain use cases where you need an alternative: | ||
|
||
* The client uses a language that is not supported by Quix Streams (Quix Streams supports Python and C# only) | ||
* There are resource constraints which mean you can't run Quix Streams | ||
* The nature of the client (for example, a web browser) | ||
|
||
In these situations Streaming Reader and Writer APIs can provide an alternative solution - for example, they can easily be accommodated in a modern web browser, or using most modern programming languages with an HTTP or SignalR client. | ||
|
||
Portal API is useful for automating processes normally carried out manually in the Quix Portal. | ||
|
||
Query API is useful for testing and examining data persisted into the Quix internal database. | ||
|
||
Each of these APIs is described in more detail in the following sections. | ||
|
||
## Streaming Writer API | ||
|
||
The [Streaming Writer API](./streaming-writer-api/index.md) enables you to stream data into a Quix topic. | ||
|
||
Streaming Writer provides both an HTTP interface and a [SignalR](https://learn.microsoft.com/en-us/aspnet/signalr/overview/getting-started/introduction-to-signalr){target=_blank} interface, with SignalR supporting WebSockets, for real-time data transfer. | ||
|
||
* [Read more about Streaming Writer API](./streaming-writer-api/index.md) | ||
|
||
## Streaming Reader API | ||
|
||
The [Streaming Reader](./streaming-reader-api/index.md) API enables you to stream data out of a Quix topic. | ||
|
||
Streaming Reader uses Microsoft's [SignalR](https://learn.microsoft.com/en-us/aspnet/signalr/overview/getting-started/introduction-to-signalr){target=_blank} technology, which provides both WebSockets and Long Polling, depending on client capabilities. | ||
|
||
* [Read more about Streaming Reader API](./streaming-reader-api/index.md) | ||
|
||
## Portal API | ||
|
||
The [Portal API](portal-api/index.md) gives access to the Quix Portal interface enabling you to automate your project deployment, management and monitoring. For example, you could build command line tools in any language with an HTTP interface available, to create, deploy, and monitor services. | ||
|
||
[Read more about Portal API](portal-api/index.md) | ||
|
||
## Query API | ||
|
||
The [Query API](query-api/index.md) enables you to fetch persisted data from Quix. You can use it for exploring the platform, testing, prototyping applications, or working with persisted data in any language with HTTP capabilities. | ||
|
||
!!! note | ||
|
||
Query API was previously known as Data Catalogue API. You may still see occasional references to the Data Catalogue API in the UI and docs. | ||
|
||
[Read more about Query API](query-api/index.md) | ||
|
||
## Comparing the APIs | ||
|
||
Use cases for these APIs are shown in the following table: | ||
|
||
| API | Interface | Purpose | Typical use case | Docs link | | ||
|---|---|---|---|----| | ||
| Streaming Writer API | HTTP, SignalR (WebSockets) | Publish data to a Quix topic | External service, command line client | [Streaming Writer API](./streaming-writer-api/index.md) | | ||
| Streaming Reader API | SignalR (WebSockets and Long Polling)| Subscribe to a Quix topic | Web browser client, dashboard, command line client | [Streaming Reader API](./streaming-reader-api/index.md) | | ||
| Portal API | HTTP (REST)| Automate Quix | Creating and monitoring deployments | [Portal API](./portal-api/index.md) | | ||
| Query API | HTTP (REST) | Retrieve persisted data | Evaluate service is processing data correctly | [Query API](./query-api/index.md) | | ||
|
||
## Next steps | ||
|
||
Read the prerequisites and how to get the API references: | ||
|
||
* Learn about [prerequisites](prerequisites.md) | ||
* Get the [API references](api-references.md) | ||
* Learn how to form [HTTP requests](http-requests.md) | ||
* Set up [SignalR](signalr.md) (if using WebSockets rather than HTTP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Prerequisites | ||
|
||
To use the APIs you'll typically need the following: | ||
|
||
1. [Sign up to Quix](https://portal.platform.quix.ai/self-sign-up). | ||
|
||
2. Obtain a [Personal Access Token](../platform/how-to/personal-access-token-pat.md) - you need this to authenticate requests. | ||
|
||
3. [Find out how to get your environment ID](../platform/how-to/get-environment-id.md) - you need this for request URLs. | ||
|
||
4. Obtain the [API references](api-references.md). | ||
|
||
Useful information can also be found in the settings panels for your environment: | ||
|
||
1. Click `Settings` in the bottom left corner of the Quix portal. | ||
|
||
2. From `Project settings` select the environment you are working with. | ||
|
||
3. Click `APIs and tokens`. | ||
|
||
You are now presented with a very useful panel. From here you have useful links to items such as API documentation (rendered with Swagger), as well as your Personal Access Tokens (PATs): | ||
|
||
![APIs and tokens](./images/apis-tokens.png){width=80%} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.