Creates a Digital Asset
JavaScript
const form = new FormData(); form.append('digital[attachment]', '<string>'); form.append('digital[variant_id]', '123'); const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}}; options.body = form; fetch('http://{defaultHost}/api/v2/platform/digitals', options) .then(res => res.json()) .then(res => console.log(res)) .catch(err => console.error(err));
{ "data": { "id": "24", "type": "digital", "attributes": { "url": "/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBLUT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--6cac9cd14eb0139474e42d68585bead023589c85/icon_256x256.jpg", "content_type": "image/png", "filename": "icon_256x256.jpg", "byte_size": 818 }, "relationships": { "variant": { "data": { "id": "94", "type": "variant" } } } } }
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Bearer <token>
<token>
Select which associated resources you would like to fetch, see: https://jsonapi.org/format/#fetching-includes
"123"
Record created
Show child attributes
Was this page helpful?