Your First Task
In this step we will:
- Create a Queue
- Create a Virtual User Token
- Create a Task
- Check the task in our dashboard
- Cancel our mock task in our dashboard
Don’t worry each step is quite simple takes 10 seconds, max 1 minute.
Let’s Begin
First you need account for your organization. We will use bricky
as an example. You must use different name.
Navigate to app.qrambo.io and create a new organization.
After creating your organization, you will be redirected to the dashboard. Let’s begin the tutorial.
Creating a Queue
- Open your dashboard and change environment to
dev
. 2. Click onCreate Queue
button. and give your queue a name asmy_first_queue
.
Queues are containers for tasks, so you have to create a new queue. For more information about queues, please read Queues.
Creating a Virtual User Token
-
Click on
Create new virtual user
button. -
Create API key for your agent for
dev
environment. -
Copy API key
Conventionaly, you need a API-Token to communicate any API, however Qrambo don’t have a global API token. You have to create a Virtual User (Agent, Robot, etc.) to get API key for this user and use it to communicate with Qrambo.
Creating a Task
You will create a task in your backend, in this step we use just python main file. However you can use any language you want.
You have to provide input data for the task. In this tutorial we will provide hello: "world"
as input data, it is just an example, but you can provide any data you want as long as it is JSON. Navigate to Task page for different examples of input data such as Image Classification
, Text Classification
, Customer Support
, PDF Reviewe
etc.
This is the code to create a task. Some parameters are highlighted.
import requests
api_key = "YOUR_API_KEY"
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": f"Bearer {api_key}"
}
queue_name = "my_first_queue"
url = "http://api.qrambo.io/queues/{queue_name}/tasks"
response = requests.post(url, json={
"input_data": {
# You can add any data in here if you want
hello: "world"
},
}, headers=headers)
print(response.json()) # if it returns success == true, it is ok
You can get more info for this API request in the documentation -> CreateTask Endpoint
Check the Task in our Dashboard
If we get 200 response, it means the task has been created successfully. Let’s check the task in our dashboard.
-
Open your dashboard and change environment to
dev
. -
Click on
Tasks
tab. -
You will see the task you created.
Last Step: Clear the Task
Let’s cancel our task because we will not need for the next steps.
-
Click on
Tasks
tab. -
Click on the task you created.
-
Click on
Cancel
button.
Next Steps
In the next step we will learn how to get result of the task to our server.