Create a Digital Link
Creates a Digital Link
POST
/
api
/
v2
/
platform
/
digital_links
Create a Digital Link
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({digital_link: {line_item_id: '1', digital_id: '1', access_counter: 0}})
};
fetch('http://{defaultHost}/api/v2/platform/digital_links', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url http://{defaultHost}/api/v2/platform/digital_links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"digital_link": {
"line_item_id": "1",
"digital_id": "1",
"access_counter": 0
}
}
'{
"data": {
"id": "5",
"type": "digital_link",
"attributes": {
"token": "6bPn1uP9HWaYecdMFkFAkcc3",
"access_counter": 0
},
"relationships": {
"digital": {
"data": {
"id": "5",
"type": "digital"
}
},
"line_item": {
"data": {
"id": "13",
"type": "line_item"
}
}
}
}
}{
"error": "Digital can't be blank, Line item can't be blank, and Access counter is not a number",
"errors": {
"digital": [
"can't be blank"
],
"line_item": [
"can't be blank"
],
"access_counter": [
"is not a number"
]
}
}Was this page helpful?
⌘I
Create a Digital Link
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({digital_link: {line_item_id: '1', digital_id: '1', access_counter: 0}})
};
fetch('http://{defaultHost}/api/v2/platform/digital_links', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url http://{defaultHost}/api/v2/platform/digital_links \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"digital_link": {
"line_item_id": "1",
"digital_id": "1",
"access_counter": 0
}
}
'{
"data": {
"id": "5",
"type": "digital_link",
"attributes": {
"token": "6bPn1uP9HWaYecdMFkFAkcc3",
"access_counter": 0
},
"relationships": {
"digital": {
"data": {
"id": "5",
"type": "digital"
}
},
"line_item": {
"data": {
"id": "13",
"type": "line_item"
}
}
}
}
}{
"error": "Digital can't be blank, Line item can't be blank, and Access counter is not a number",
"errors": {
"digital": [
"can't be blank"
],
"line_item": [
"can't be blank"
],
"access_counter": [
"is not a number"
]
}
}
