Introduction to Refonte.AI API
Data Engine Core Resources
Data Engine Tasks Types
This endpoint facilitates the creation of a new batch within a project.
project string required
The name of the project this batch (and its tasks) belong to.
name string required
Name identifying this batch. Must be unique among all batches belonging to a customer.
callback string
The full url (including the scheme http:// or https://) or email address of the callback that will be used when the task is completed.
calibration_batch boolean
Only applicable for Rapid projects. Create an calibration batch by setting the calibration_batch flag to true.
self_label_batch boolean
Only applicable for Rapid projects. Create a self label batch by setting the self_label_batch flag to true.
Request
Python
POST /v1/projects
import requests
# Replace with your actual API key
API_KEY = 'your_api_key_here'
# Define the URL for the API endpoint
url = "https://api.refonte.com/v1/batches"
# Define the payload for creating a new batch
payload = {
# The project associated with the batch
"project": "kitten_labeling",
# The name of the batch
"name": "kitten_labeling_2020-07",
# Indicates if the batch is a calibration batch
"calibration_batch": False,
# Indicates if the batch is a self-label batch
"self_label_batch": False
}
# Set up the headers for the request
headers = {
# Specify that we want the response in JSON format
"accept": "application/json",
"content-type": "application/json"
}
# Adding authentication to the POST request
# The auth parameter requires a tuple with the API key and an empty string
response =
requests.post(url, json=payload, headers=headers, auth=(API_KEY, ''))
# Print the response text to see the result
print(response.text)
For "Refonte.Ai Rapid and Studio" customers only, finalizes a batch with name batchName so its tasks can be worked on.
Customers that are not part of Rapid/Studio are exempt from using this endpoint; contacting it will get a 200 success status code but no further action.
batchName string required
Request
Python
POST /v1/batches/{batchName}/finalize
import requests
# Replace with your actual API key
API_KEY = 'your_api_key_here'
# Define the URL for the API endpoint
url = "https://api.refonte.com/v1/batches/kitten_labeling_2020-07/finalize"
# Set up the headers for the request
headers = {
"accept": "application/json" # Specify that we want the response in JSON format
}
# Adding authentication to the POST request
# The auth parameter requires a tuple with the API key and an empty string
response = requests.post(url, headers=headers, auth=(API_KEY, ''))
# Print the response text to see the result
print(response.text)
Response
{
"project": "TEST-PROJECT",
"name": "BATCH-NAME",
"callback": "callback@url.com",
"status": "in_progress",
"created_at": "2023-08-01T23:04:12.168Z",
"metadata": {}
}
This endpoint returns the details of a batch with the name :batchName.
batchName string required
batchName to retrieve
Request
Python
GET /v1/batches/{batchName}
import requests
# Replace with your actual API key
API_KEY = 'your_api_key_here'
# Define the URL for the API endpoint
url = "https://api.refonte.com/v1/batches/kitten_labeling_2020-07"
# Set up the headers for the request
headers = {
"accept": "application/json" # Specify that we want the response in JSON format
}
# Adding authentication to the GET request
# The auth parameter requires a tuple
# with the API key and an empty string
response = requests.get(url, headers=headers, auth=(API_KEY, ''))
# Print the response text to see the result
print(response.text)
Response
{
"project": "PROJECT-NAME",
"name": "BATCH_NAME",
"callback": "callback@url.com",
"status": "in_progress",
"created_at": "2023-05-16T19:02:23.149Z",
"metadata": {}
}
This endpoint returns the status of a batch with the name :batchName, as well as the counts of its tasks grouped by task status.
batchName string required
Required batchName to get status.
Request
Python
GET /v1/batches/{batchName}/status
import requests
# Replace with your actual API key
API_KEY = 'your_api_key_here'
# Define the URL for the API endpoint
url = "https://api.refonte.com/v1/batches/kitten_labeling_2020-07/status"
# Set up the headers for the request
headers = {
"accept": "application/json" # Specify that we want the response in JSON format
}
# Adding authentication to the GET request
# The auth parameter requires a tuple with the API key and an empty string
response = requests.get(url, headers=headers, auth=(API_KEY, ''))
# Print the response text to see the result
print(response.text)
Response
{
"status": "in_progress",
"tasks_pending": 9,
"tasks_completed": 1
}
All of your batches have a paged endpoint like this one. Based on created_at, batches will be returned in descending order. The page size and the number of results to skip are determined by the offset and limit parameters that govern pagination.
project string
Project name to filter batches by.
status string
Status to filter batches by (staging or in_progress or completed).
detailed boolean
Get details about the progress of the batches.
start_time string
The minimum value of created_at for batches to be returned
end_time string
The maximum value of created_at for batches to be returned
Request
Python
GET /v1/batches
import requests
# Replace with your actual API key
API_KEY = 'your_api_key_here'
# Define the URL for the API endpoint with query parameters
params = {
project: kitten_labeling,
status: in_progress,
detailed: false,
start_time: 2020-05-21,
end_time: 2021-01-01,
limit: 100,
offset: 0
}
url = "https://api.refonte.com/v1/batches?{params}"
# Set up the headers for the request
headers = {
# Specify that we want the response in JSON format
"accept": "application/json"
}
# Adding authentication to the GET request
# The auth parameter requires a tuple with the API key and an empty string
response = requests.get(url, headers=headers, auth=(API_KEY, ''))
# Print the response text to see the result
print(response.text)
Response
{
"type": "imageannotation",
"name": "project_name",
"param_history": [
{
"instruction": "Instructions",
"version": 0,
"created_at": "2021-04-25T07:38:32.368Z"
}
],
"created_at": "2021-04-25T07:38:32.368Z"
}
This endpoint updates the priority of a batch.
The batch priority must to adhere to the identical guidelines as the priority of a single job, meaning that it must fall between 10 and 30 for each priority level.
Prioritizing a task will affect which order it is picked up initially, but it has no bearing on which order a task or group of tasks will be returned to you. As a result, unfinished jobs can be given a higher priority; nevertheless, initiated tasks won't be affected.
batchName string required
The name of the batch to update.
batchName string required
The new priority for the batch. The priority should be between 10, representing the lowest priority, and 30, representing the highest priority.
Request
Python
POST /v1/batches/{batchName}/prioritize
import requests
# Replace with your actual API key
API_KEY = 'your_api_key_here'
# Define the URL for the API endpoint
url =
"https://api.refonte.com/v1/batches/kitten_labeling_2020-07/prioritize"
# Define the payload to update the batch priority
payload = {
"priority": 10 # Set the priority level
}
# Set up the headers for the request
headers = {
# Specify that we want the response in JSON format
"accept": "application/json",
"content-type": "application/json"
}
# Adding authentication to the POST request
# The auth parameter requires a tuple
# with the API key and an empty string
response =
requests.post(url, json=payload, headers=headers, auth=(API_KEY, ''))
# Print the response text to see the result
print(response.text)
Response
{
"result": "success"
}
Updated about 2 months ago