I wrote code using the NodeJS SDK that generates a fairly complex video. I have later decided to use Zapier to create this video out of answers from SurveySparrow. In Zapier I can POST to the ShotStack API but I have to provide the JSON payload directly. Is there a way in which I will not have to re-write the whole JSON from scratch, maybe getting the JSON as an output from the code I wrote in the SDK?
Hi @femxxhealth,
Yes you can get the JSON of any template you have built by using the UUID of a completed render and polling the API to check the render status by adding timeline=true
as a parameter. The JSON will then be available inside of the data
property.
curl -X GET \
-H "Content-Type: application/json" \
-H "x-api-key: ptmpOiyKgGYMnnONwvXH7FHzDGOazrIjaEDUS7Cf" \
https://api.shotstack.io/stage/render/d2b46ed6-998a-4d6b-9d91-b8cf0193a655?timeline=true
This would return the following:
{
"success":true,
"message":"OK",
"response":{
"id":"d2b46ed6-998a-4d6b-9d91-b8cf0193a655",
"owner":"hckwccw3q3",
"plan":"sandbox",
"status":"done",
"url":"https://s3-ap-southeast-2.amazonaws.com/shotstack-api-stage-output/hckwccw3q3/d2b46ed6-998a-4d6b-9d91-b8cf0193a655.mp4",
"data":{
"output":{
...
},
"timeline":{
...
}
},
"created":"2019-04-16T12:02:42.148Z",
"updated":"2019-04-16T12:02:51.867Z"
}
}
1 Like
You can also just dump any object created using the SDK using JSON.stringify
:
const edit = new Shotstack.Edit;
edit
.setTimeline(timeline)
.setOutput(output);
console.log(JSON.stringify(edit, null, 2));
That will just output the JSON to the terminal, or you could write it to a file etc…
1 Like
Thank you so much, this saved me a lot of time
1 Like
Thanks a lot! Very helpful
1 Like