Simple render with node.js and axios package (for http post).
https://www.npmjs.com/package/axios
Template
https://mockupsjar.com/mockups/rustic-frame
Input image
https://dummyimage.com/400x600/4697c2/fff.jpg
https://dummyimage.com/400x600/4697c2/fff
Render output
Code sample
const axios = require('axios')
const API_URL = process.env.API_URL // <https://api.mockupsjar.com>
const API_TOKEN = process.env.API_TOKEN // Put your API TOKEN in here
// template: <https://mockupsjar.com/mockups/rustic-frame>
const url = '<https://api.mockupsjar.com/mockups/render/rustic-frame>'
console.log('mockupsjar - simple node render with axios')
axios({
method: 'post',
url,
headers: {
Authorization: 'Bearer ' + API_TOKEN
},
data: {
zoomLevel: 1,
format: 'jpg',
input: ['<https://dummyimage.com/400x600/4697c2/fff.jpg>']
}
})
.then((response) => {
console.log(response.status, response.statusText, JSON.stringify(response.data, null, ' '))
})
.catch((e) => {
console.info('exception', e.message)
})
Response
200 OK {
"status": "success",
"data": {
"slug": "rustic-frame",
"name": "Rustic Frame",
"status": "successful",
"zoomLevel": 1,
"format": "jpg",
"result": {
"url": "<https://mockupsjar-production.s3-eu-west-1.amazonaws.com/renders/mockup-4CqoSJ57py6zdEGe.jpg>",
"previewUrl": "<https://mockupsjar-production.s3-eu-west-1.amazonaws.com/renders/10Q9awBccvx6Nq71-TooKmcmbIhy0zenN.jpg>"
}
}
}