Check redoing a draft
social.edition.redo.check@1
Ask whether one draft's caption and picture can each be made again now, and why not. Requires Write social. It reads only: nothing is made, bought or started. A part is unavailable when no recipe made the draft, it has gone to the platform, you cannot read its recipe, the recipe does not make that part, or its account no longer takes the post.
Which parts can be made again
Nothing is made or bought.
# A new operationId for each new request; the same one to retry it.
curl https://api.growlocal.site/api/v1/profiles/YOUR_BUSINESS_ID/invocations \
-H "Authorization: Bearer gl_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"target": {
"featureId": "YOUR_FEATURE_ID",
"export": "checkEditionRedo",
"contractRef": "social.edition.redo.check@1"
},
"operationId": "redo-check-1",
"input": {
"editionRef": {
"businessProfileId": "YOUR_BUSINESS_ID",
"featureId": "juniper-cakes.data",
"collectionId": "juniper-cakes.editions",
"id": "YOUR_EDITION_ID"
}
}
}'
// A new operationId for each new request; the same one to retry it.
const response = await fetch(
"https://api.growlocal.site/api/v1/profiles/YOUR_BUSINESS_ID/invocations",
{
method: "POST",
headers: {
Authorization: "Bearer gl_YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"target": {
"featureId": "YOUR_FEATURE_ID",
"export": "checkEditionRedo",
"contractRef": "social.edition.redo.check@1"
},
"operationId": "redo-check-1",
"input": {
"editionRef": {
"businessProfileId": "YOUR_BUSINESS_ID",
"featureId": "juniper-cakes.data",
"collectionId": "juniper-cakes.editions",
"id": "YOUR_EDITION_ID"
}
}
}),
},
);
const receipt = await response.json();
console.log(response.status, receipt);
import requests
# A new operationId for each new request; the same one to retry it.
response = requests.post(
"https://api.growlocal.site/api/v1/profiles/YOUR_BUSINESS_ID/invocations",
headers={"Authorization": "Bearer gl_YOUR_API_KEY"},
json={
"target": {
"featureId": "YOUR_FEATURE_ID",
"export": "checkEditionRedo",
"contractRef": "social.edition.redo.check@1",
},
"operationId": "redo-check-1",
"input": {
"editionRef": {
"businessProfileId": "YOUR_BUSINESS_ID",
"featureId": "juniper-cakes.data",
"collectionId": "juniper-cakes.editions",
"id": "YOUR_EDITION_ID",
},
},
},
timeout=30,
)
print(response.status_code, response.json())
Parameters
What goes in input:
| Name | Type | Required | Description |
|---|---|---|---|
editionRef |
object | Yes | The draft to ask about, as a row reference. |
editionRef.businessProfileId |
string | Yes | The business that owns it. |
editionRef.featureId |
string | Yes | The editions Data feature. |
editionRef.collectionId |
string | Yes | The editions table. |
editionRef.id |
string | Yes | The row id. |
Response
A call that worked answers 200 with an applied receipt; its output holds these fields. GET /catalog/social.edition.redo.check@1 answers the complete shape as JSON Schema.
| Name | Type | Description |
|---|---|---|
caption |
any JSON value | Whether the caption can be made again: available, and a plain reason when not. |
caption.available |
boolean | True when the caption can be made again now. |
caption.code |
one of not-recipe-made, gone-out, not-allowed, source-unavailable, recipe-cannot, photo, no-picture, account-cannot, running, other |
Why it cannot, for a screen to act on: not-recipe-made, gone-out, not-allowed, source-unavailable, recipe-cannot, photo, no-picture, account-cannot, running or other. Present whenever available is false. |
caption.paid |
boolean | True when making it again buys a picture. |
caption.reason |
string | Why it cannot, in plain words. |
caption.instead |
one of choose-another-photo |
What to do in its place. |
picture |
any JSON value | Whether the picture can be made again: available, paid when it buys a picture, a reason when not, and instead: "choose-another-photo" for a draft made from the person's own photo. |
picture.available |
boolean | True when the picture can be made again now. |
picture.code |
one of not-recipe-made, gone-out, not-allowed, source-unavailable, recipe-cannot, photo, no-picture, account-cannot, running, other |
Why it cannot, for a screen to act on; the same names as caption.code. |
picture.paid |
boolean | True when making it again buys a picture, so a person's own press or an approval comes first. |
picture.reason |
string | Why it cannot, in plain words. |
picture.instead |
one of choose-another-photo |
What to do in its place. |
running |
object or null | The redo of this draft that has not ended, whoever started it (a person, Chat or a key): part, runRef, startedAt, revision (pass it as expectedRevision to automation.run.cancel@1) and canStop (whether you may cancel it, as Automations decides); otherwise null. Only one redo runs per draft at a time, so both parts say running meanwhile and a second redo is refused with SOCIAL.REDO_RUNNING. Told only to a caller who can read the draft. |
last |
object or null | The newest redo that ended without being used (not-applied: the draft changed while it ran) or failed: part, runRef, status, endedAt and paid (it bought a picture). Only within 7 days, while no redo runs and the draft hasn't changed since it ended; otherwise null. |
{
"status": "applied",
"operationId": "redo-check-1",
"output": {
"caption": {
"available": true
},
"picture": {
"available": true,
"paid": true
},
"running": null,
"last": null
}
}
Errors
It reads and changes nothing. Besides the answers every request can get (Errors), its receipt can say:
| Status | HTTP | What it means |
|---|---|---|
rejected |
400, or 403 when it's a matter of access | Not done. diagnostics says why: each has a code, a path into what you sent and a message. |
The codes in diagnostics you're most likely to see:
| Code | Status | What it means |
|---|---|---|
DATA.ROW_NOT_FOUND |
rejected |
No such draft here for this key. |