TreeQ API Reference

This page will describe all information about TreeScale TreeQ Queue storage API calls and most important parts. API itself is fully RESTful so it could be done using any language or environment. The API endpoint root URL is https://dash.treescale.com/q/[api name] and API calls described below will contain API names as a titles. NOTE: All API calls are HTTP POST requests for giving more flexibility in terms of HTTP Body data, and make sure you got API Token as it is described here

Add New Queue - /q/add

Before putting or getting message/data from Queue you actually need to create it. This API Endpoint is about making new Queue, which completely isolated from other Queue's. POST Parameters

  • name - Queue name for later usage and monitoring

Example

~# curl -X POST -H 'Authorization: <api token>' --data 'name=queue1' https://dash.treescale.com/q/add

Delete Queue - /q/delete/<queue>

If you don't need Queue anymore or want to delete all available data in it, just delete queue using his name as a post parameter. POST Parameters N/A

Example

~# curl -X POST -H 'Authorization: <api token>' https://dash.treescale.com/q/delete/queue1

Information about Queue - /q/info/<queue>

Using basic API request you can get information about Queue describing content of Queue storage, including message count and availability. POST Parameters N/A

Example

~# curl -X POST -H 'Authorization: <api token>' https://dash.treescale.com/q/info/queue1

Insert Data To Queue - /q/insert/<queue>

For uploading data to Queue you need to call this endpoint. It will handle your data as a HTTP POST Body and you can send any kind of data including fully binary data. POST Parameters

  • HTTP Body - data should be in request body, so that server will get all body data including binary data, and will place it in requested Queue.

Example

~# curl -X POST -H 'Authorization: <api token>' --data='ANY KIND OF DATA HERE' https://dash.treescale.com/q/insert/queue1

Response If data insertion would be successful server will respond with JSON Content like {"id": 5} with message ID in it, so that you can do later actions using that ID, to access inserted message directly (if you need it).

Remove Data From Queue - /q/remove/<queue>/<message id>

If you done with message in most cases you probably need to remove message from Queue and move forward. This endpoint will receive Queue name and message ID as a URL parameters and will remove message from Queue storage. If Queue or Message doesn't exists server will respond with 404 status. POST Parameters N/A

Example

~# curl -X POST -H 'Authorization: <api token>' https://dash.treescale.com/q/remove/queue1/5

First Message From Queue - /q/first/<queue>

In most cases using Queue means don't deal with message ID's, instead you just need to get next data available in Queue. On Success this endpoint will return JSON {"id": 5} containing ID of first message in this queue, so that later you can call Lock and Delete functions for this message. If Queue doesn't have any messages in it, this endpoint will return 404 error. POST Parameters N/A

Example

~# curl -X POST -H 'Authorization: <api token>' https://dash.treescale.com/q/first/queue1

Last Message From Queue - /q/last/<queue>

In most cases using Queue means don't deal with message ID's, instead you just need to get last data available in Queue. On Success this endpoint will return JSON {"id": 5} containing ID of last message in this queue, so that later you can call Lock and Delete functions for this message. If Queue doesn't have any messages in it, this endpoint will return 404 error. POST Parameters N/A

Example

~# curl -X POST -H 'Authorization: <api token>' https://dash.treescale.com/q/last/queue1

Lock Message in Queue - /q/lock/<queue>/<message id>

Locking message means that service taking ownership for this message and it is available only for this service. This is giving specific advantage of developing concurrent applications, so that you can make sure that each data processed only once. If message with this ID already locked this endpoint will respond with 403 error code. If message or Queue unavailable it will respond with 404 error. POST Parameters N/A

Example

~# curl -X POST -H 'Authorization: <api token>' https://dash.treescale.com/q/lock/queue1/5

Response This endpoint will respond with the content of message which you already uploaded by calling Insert endpoint. HTTP Response Body will contain your data with same representation as we got during insertion process.

Lock Message in Queue - /q/lock/<queue>/<message id>

Unlocking is reverse action for Locking, which means, if you don't need to delete this message and need to keep it in Queue you making unlock so that your other services would have access to this message. It depends on your application usecase. If message or Queue unavailable it will respond with 404 error. POST Parameters N/A

Example

~# curl -X POST -H 'Authorization: <api token>' https://dash.treescale.com/q/unlock/queue1/5

Response {"unlocked": true}

 

 

results matching ""

    No results matching ""