Jobs
A general guide for submitting jobs via API
1
Get an Access Token
Name
Type
Description
Name
Type
Description
import requests
response = requests.post(
"https://api.bytenite.com/v1/auth/access_token",
json = {
"apiKey": "ey2WmEsSMK7wdxpK5MaEHXeWCD5KEJZ79Koe68yrHL4kdnnTXT01hu2iss43BdaCCMgJ3dBh2IOVCycTt1mwkT3QR1dLxRFpK7TW7ExvcuCXio6nKsGjk9dYY8nbsFffrUVvYSQYsuQoF3NIb8sS4MDyZfOgGKZL9z8x22cwrwEck7vIokVhQ9fyWRVU2vwRiX3X4bQFuqTkkWCi5Vfy8IkGkga7ZPMPb21FxqK6cHRJ3zmI1JZZoZZxERnQcWJTpZRyCP4SNTuRm3ueVDNntFqYWYYrseNLcCIS42MpR00Z9rI9I5xxuQD6VQvHVrpOaPucg1E4Vw54xXr2LKEy9uHcM5WUQHkdfhiXo6zyVbZMrbjLpepgeS4nEja="
}
)
token = response.json()["token"]2
Create a New Job
Name
Type
Description
Name
Type
Description
Name
Type
Description
response = requests.post(
"https://api.bytenite.com/v1/customer/jobs",
headers = {
"Authorization": token
},
json = {
"name": "My job with img-gen-diffusers template",
"templateId": "img-gen-diffusers"
}
)
jobId = response.json()["job"]["id"]3
Submit a Data Source and Destination
Name
Type
Description
Name
Type
Description
Name
Type
Description
response = requests.patch(
f"https://api.bytenite.com/v1/customer/jobs/{jobId}/datasource",
headers = {
"Authorization": token
},
json = {
"dataSource": {
"dataSourceDescriptor": "url",
"params": {
"@type": "type.googleapis.com/bytenite.data_source.HttpDataSource",
"url": "https://storage.googleapis.com/my-public-bucket/my-input-file.txt"
}
},
"dataDestination": {
"dataSourceDescriptor": "bucket"
}
}
)4
Submit Job Parameters
Name
Type
Description
Name
Type
Description
Name
Type
Description
response = requests.patch(
f"https://api.bytenite.com/v1/customer/jobs/{jobId}/params",
headers = {
"Authorization": token
},
json = {
"partitioner": {
"numImages": 20
},
"app": {
"prompt": "A beautiful sunset over the jungle"
},
"assembler": {
"outExtension": "jpeg"
}
}
)Last updated
Was this helpful?

