create or update content
This creates new content, or updates existing content.
To create new content, the cardId should not be provided
To update existing content, its cardId should be provided
An example of the properties that can be set for card content can be found here.
Example Request Body:
{
"cardId": "",
"title": "Test file validation",
"deleted": false,
"createdAt": "",
"updatedAt": "",
"content": {
"activity": "yoto_Player",
"chapters": [
{
"title": "Centrifuge",
"key": "4eda8628-acd8-4298-bec6-17cc33...",
"tracks": [
{
"title": "Centrifuge.mp3",
"trackUrl": "uo-7xRmZo8UynxgT_brGPrvXHCT5L_...",
"key": "4eda8628-acd8-4298-bec6-17cc33...",
"format": "mpeg",
"uid": "",
"type": "audio",
"overlayLabel": "",
"duration": 170,
"fileSize": 5473506,
"channels": "stereo"
}
],
"_status": {
"status": "uploaded",
"file": {},
"percentage": 100,
"error": null
}
}
],
"restricted": true,
"config": {
"onlineOnly": false
},
"version": 1
},
"metadata": {}
}
Body
application/json
cardIdstring
Example: "31yYU"
contentobject
metadataobject
titlestring
Example: "Testing Podcast"
Responses
200 OK (Create a card) / 200 OK (Update a card)
Content-Type: application/json
cardobject
_idstring
cardIdstring
contentobject
chaptersarray
[items]
configobject
resumeTimeoutnumber
playbackTypestring
createdAtstring
metadataobject
descriptionstring
titlestring
updatedAtstring
userIdstring
{ "card": { "_id": "676016ea43bedbaa54a70549", "cardId": "31yYU", "content": { "chapters": [], "config": { "resumeTimeout": 2592000 }, "playbackType": "linear" }, "createdAt": "2024-12-16T12:02:50.164Z", "metadata": {}, "title": "Testing Podcast", "updatedAt": "2024-12-16T12:02:50.164Z", "userId": "2kRM9HdDaanNVdLqnjn1d5xFH46Ffmkh@clients" } }
POST
/content
Server URL:https://api.yotoplay.com
Authorization
bearerAuth
Request Body
Samples
curl "https://api.yotoplay.com/content" --header "Authorization: Bearer [YOUR_TOKEN]"
const options = { method: 'POST', headers: { 'Authorization': 'Bearer [YOUR_TOKEN]' } }; fetch('https://api.yotoplay.com/content', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.yotoplay.com/content",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer [YOUR_TOKEN]"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests url = "https://api.yotoplay.com/content" headers = { 'Authorization: Bearer [YOUR_TOKEN]' } response = requests.request("POST", url, headers=headers) print(response.text)