Check a draft
const url = 'https://api.pixonaut.app/v1/automations/check';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"body":{"steps":[{"id":"order","settings":{"copies":1,"shipTo":"customer"},"type":"place_order"}]},"trigger":"print.completed"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.pixonaut.app/v1/automations/check \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "body": { "steps": [ { "id": "order", "settings": { "copies": 1, "shipTo": "customer" }, "type": "place_order" } ] }, "trigger": "print.completed" }'Operation ID: automations.check
What saving this draft would refuse and warn of, and for each step that acts at a printshop, what it can do at every printshop it can reach: yes, no and why, or only while a rule holds. Nothing is saved.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The automation this draft saves, when it exists: a member who muted it is warned of as not hearing its notifications, and it is left out of the warning of another automation sending the same.
The automation’s tree of steps.
object
object
Every one holds.
object
At least one holds.
object
It does not hold.
object
The fact compared.
It holds when the fact is one of these: each at most 200 characters, or 2054 for an origin, which may name a store’s site.
object
It holds from this many copies up.
It holds up to this many copies.
The order’s quantity.
object
The order’s delivery address.
Whether it must be set, or must not.
The steps, in the order they run. A step’s type names an action from the catalogue.
object
Further steps, under each branch’s name.
object
Its id, unique in the body: what a firing names it by.
What its type takes; the draft check refuses settings the type does not.
object
Its action (approve, create_print, place_order, reroute, cancel_order, notify, email, webhook) or flow step (only_if, paths, wait_for, delay).
The event it fires on; null for none yet, which fires on nothing. One with none cannot be enabled.
Examples
Example
{ "body": { "steps": [ { "id": "order", "settings": { "copies": 1, "shipTo": "customer" }, "type": "place_order" } ] }, "trigger": "print.completed"}Responses
Section titled “Responses”The check
object
What a save of this draft refuses.
object
What is wrong, in words.
The step it is about.
Each step that acts at a printshop.
object
Each printshop the step can reach, and what it can do there.
object
object
Why it cannot act there.
object
When it can: checked when it runs, and a step that meets it unmet is blocked.
What a save allows, and a member should know.
object
What is wrong, in words.
The step it is about.
Examples
Example
{ "refusals": [], "steps": [ { "printshops": [ { "can": "yes", "id": "psc_4e8a9f6c1d2e", "name": "Printful" }, { "can": "no", "id": "psc_7b2c3d4e5f6a", "name": "Riso Corner", "reason": "The printshop “Riso Corner” is paused and takes no new orders. Turn Takes orders back on for it, or order from another printshop." } ], "stepId": "order", "type": "place_order" } ], "warnings": [ { "code": "acts_at_some", "message": "Place an order cannot act at Riso Corner.", "stepId": "order" } ]}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Refused: invalid_body
object
Always sent with invalid_body.
Examples
invalid_body
{ "error": "invalid_body", "fields": [ "string" ]}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Refused: unauthorized
object
Examples
unauthorized
{ "error": "unauthorized"}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Refused: feature_disabled, origin_forbidden, forbidden
object
The feature the tenant does not have. Always sent with feature_disabled.
Examples
feature_disabled
{ "error": "feature_disabled", "feature": "api"}forbidden
{ "error": "forbidden"}origin_forbidden
{ "error": "origin_forbidden"}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Refused: payload_too_large
object
Always sent with payload_too_large.
Examples
payload_too_large
{ "error": "payload_too_large", "maxBytes": 0}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Refused: db_error. A request that failed unexpectedly answers as text instead.
object
Examples
db_error
{ "error": "db_error"}Headers
Section titled “Headers”Every response names the request it answers in X-Request-Id: the id the request was sent with in that header, when it is well formed, else one the API gave it. Quote it when reporting a refusal or a failure: the API’s log lines for that request carry it.
Questions? Write to [email protected].