Functions
Invoke function
Device must be enrolled. Top-level sql/operation/params are forbidden. If the API key function_ids list does not include function_id, the response is 403 function_not_allowed and the device is not called.
POST
/
v1
/
devices
/
{device_id}
/
functions
/
{function_id}
Invoke function
curl --request POST \
--url https://api.orquestr.dev/cloud/v1/devices/{device_id}/functions/{function_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"input": {}
}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: {}})
};
fetch('https://api.orquestr.dev/cloud/v1/devices/{device_id}/functions/{function_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.orquestr.dev/cloud/v1/devices/{device_id}/functions/{function_id}"
payload = { "input": {} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"device_id": "d7777777-7777-7777-7777-777777777777",
"function_id": "sicarv4.products.list",
"operation": "db.query",
"result": {
"status": "ok",
"command_id": "cmd-9f3a2b1c",
"rows": [
{
"id": 1,
"clave": "SKU-001",
"descripcion": "Café 1kg"
}
],
"row_count": 1
}
}
}{
"error": {
"code": "bad_request",
"message": "Invalid body"
}
}{
"error": {
"code": "unauthorized",
"message": "Unauthorized"
}
}{
"error": {
"code": "forbidden",
"message": "Account not eligible for this action"
}
}{
"error": {
"code": "function_not_allowed",
"message": "API key cannot invoke this function"
}
}{
"error": {
"code": "not_found",
"message": "Not found"
}
}{
"error": {
"code": "conflict",
"message": "Device quota exceeded"
}
}{
"error": {
"code": "rate_limited",
"message": "Too many requests",
"details": {
"retry_after": 60
}
}
}{
"error": {
"code": "gateway_error",
"message": "Gateway request failed"
}
}Authorizations
Path Parameters
Response
Success
The response is of type object.
⌘I
Invoke function
curl --request POST \
--url https://api.orquestr.dev/cloud/v1/devices/{device_id}/functions/{function_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"input": {}
}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({input: {}})
};
fetch('https://api.orquestr.dev/cloud/v1/devices/{device_id}/functions/{function_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.orquestr.dev/cloud/v1/devices/{device_id}/functions/{function_id}"
payload = { "input": {} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"data": {
"device_id": "d7777777-7777-7777-7777-777777777777",
"function_id": "sicarv4.products.list",
"operation": "db.query",
"result": {
"status": "ok",
"command_id": "cmd-9f3a2b1c",
"rows": [
{
"id": 1,
"clave": "SKU-001",
"descripcion": "Café 1kg"
}
],
"row_count": 1
}
}
}{
"error": {
"code": "bad_request",
"message": "Invalid body"
}
}{
"error": {
"code": "unauthorized",
"message": "Unauthorized"
}
}{
"error": {
"code": "forbidden",
"message": "Account not eligible for this action"
}
}{
"error": {
"code": "function_not_allowed",
"message": "API key cannot invoke this function"
}
}{
"error": {
"code": "not_found",
"message": "Not found"
}
}{
"error": {
"code": "conflict",
"message": "Device quota exceeded"
}
}{
"error": {
"code": "rate_limited",
"message": "Too many requests",
"details": {
"retry_after": 60
}
}
}{
"error": {
"code": "gateway_error",
"message": "Gateway request failed"
}
}
