Playlists
Create playlist
Creates a playlist in a project.
POST
/
projects
/
{project_id}
/
playlists
Create playlist
curl --request POST \
--url https://api.beyondwords.io/v1/projects/{project_id}/playlists \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"title": "My playlist",
"enabled": true,
"type": "manual",
"content_limit": 25,
"content": [
{
"id": "d7dfd636-098c-4b1b-83e5-15a3cba5a0bd"
},
{
"id": "ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0"
},
{
"id": "1c0274ba-362d-4dea-8a34-5177061bf032"
}
]
}
'import requests
url = "https://api.beyondwords.io/v1/projects/{project_id}/playlists"
payload = {
"title": "My playlist",
"enabled": True,
"type": "manual",
"content_limit": 25,
"content": [{ "id": "d7dfd636-098c-4b1b-83e5-15a3cba5a0bd" }, { "id": "ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0" }, { "id": "1c0274ba-362d-4dea-8a34-5177061bf032" }]
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'My playlist',
enabled: true,
type: 'manual',
content_limit: 25,
content: [
{id: 'd7dfd636-098c-4b1b-83e5-15a3cba5a0bd'},
{id: 'ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0'},
{id: '1c0274ba-362d-4dea-8a34-5177061bf032'}
]
})
};
fetch('https://api.beyondwords.io/v1/projects/{project_id}/playlists', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.beyondwords.io/v1/projects/{project_id}/playlists",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => 'My playlist',
'enabled' => true,
'type' => 'manual',
'content_limit' => 25,
'content' => [
[
'id' => 'd7dfd636-098c-4b1b-83e5-15a3cba5a0bd'
],
[
'id' => 'ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0'
],
[
'id' => '1c0274ba-362d-4dea-8a34-5177061bf032'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.beyondwords.io/v1/projects/{project_id}/playlists"
payload := strings.NewReader("{\n \"title\": \"My playlist\",\n \"enabled\": true,\n \"type\": \"manual\",\n \"content_limit\": 25,\n \"content\": [\n {\n \"id\": \"d7dfd636-098c-4b1b-83e5-15a3cba5a0bd\"\n },\n {\n \"id\": \"ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0\"\n },\n {\n \"id\": \"1c0274ba-362d-4dea-8a34-5177061bf032\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.beyondwords.io/v1/projects/{project_id}/playlists")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"My playlist\",\n \"enabled\": true,\n \"type\": \"manual\",\n \"content_limit\": 25,\n \"content\": [\n {\n \"id\": \"d7dfd636-098c-4b1b-83e5-15a3cba5a0bd\"\n },\n {\n \"id\": \"ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0\"\n },\n {\n \"id\": \"1c0274ba-362d-4dea-8a34-5177061bf032\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beyondwords.io/v1/projects/{project_id}/playlists")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"My playlist\",\n \"enabled\": true,\n \"type\": \"manual\",\n \"content_limit\": 25,\n \"content\": [\n {\n \"id\": \"d7dfd636-098c-4b1b-83e5-15a3cba5a0bd\"\n },\n {\n \"id\": \"ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0\"\n },\n {\n \"id\": \"1c0274ba-362d-4dea-8a34-5177061bf032\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"title": "My playlist",
"enabled": true,
"type": "manual",
"content_limit": 25,
"content": [
{
"id": "d7dfd636-098c-4b1b-83e5-15a3cba5a0bd",
"status": "processed",
"title": "Content title",
"source_id": "example-source-id",
"source_url": "https://example.com/some-article",
"author": "John Smith",
"image_url": "https://example.com/image.jpeg",
"metadata": {
"key": "value"
},
"audio": [
{
"id": 1,
"content_type": "application/vnd.apple.mpegurl",
"url": "https://example.com/audio.m3u8",
"duration": 10000
},
{
"id": 2,
"content_type": "audio/mpeg,",
"url": "https://example.com/audio.mp3",
"duration": 10000
}
],
"video": [
{
"id": 1,
"content_type": "video/mp4",
"url": "https://example.com/waveform-video.mp4",
"duration": 10000
}
],
"ads_enabled": true,
"created": "2023-01-01 00:00:00 UTC",
"updated": "2023-01-01 00:00:05 UTC"
}
],
"settings": null,
"created": "2023-01-01 00:00:00 UTC",
"updated": "2023-01-01 00:00:05 UTC"
}Body
application/json
Response
201 - application/json
successful
Was this page helpful?
⌘I
Create playlist
curl --request POST \
--url https://api.beyondwords.io/v1/projects/{project_id}/playlists \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--data '
{
"title": "My playlist",
"enabled": true,
"type": "manual",
"content_limit": 25,
"content": [
{
"id": "d7dfd636-098c-4b1b-83e5-15a3cba5a0bd"
},
{
"id": "ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0"
},
{
"id": "1c0274ba-362d-4dea-8a34-5177061bf032"
}
]
}
'import requests
url = "https://api.beyondwords.io/v1/projects/{project_id}/playlists"
payload = {
"title": "My playlist",
"enabled": True,
"type": "manual",
"content_limit": 25,
"content": [{ "id": "d7dfd636-098c-4b1b-83e5-15a3cba5a0bd" }, { "id": "ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0" }, { "id": "1c0274ba-362d-4dea-8a34-5177061bf032" }]
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'My playlist',
enabled: true,
type: 'manual',
content_limit: 25,
content: [
{id: 'd7dfd636-098c-4b1b-83e5-15a3cba5a0bd'},
{id: 'ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0'},
{id: '1c0274ba-362d-4dea-8a34-5177061bf032'}
]
})
};
fetch('https://api.beyondwords.io/v1/projects/{project_id}/playlists', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.beyondwords.io/v1/projects/{project_id}/playlists",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'title' => 'My playlist',
'enabled' => true,
'type' => 'manual',
'content_limit' => 25,
'content' => [
[
'id' => 'd7dfd636-098c-4b1b-83e5-15a3cba5a0bd'
],
[
'id' => 'ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0'
],
[
'id' => '1c0274ba-362d-4dea-8a34-5177061bf032'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.beyondwords.io/v1/projects/{project_id}/playlists"
payload := strings.NewReader("{\n \"title\": \"My playlist\",\n \"enabled\": true,\n \"type\": \"manual\",\n \"content_limit\": 25,\n \"content\": [\n {\n \"id\": \"d7dfd636-098c-4b1b-83e5-15a3cba5a0bd\"\n },\n {\n \"id\": \"ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0\"\n },\n {\n \"id\": \"1c0274ba-362d-4dea-8a34-5177061bf032\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.beyondwords.io/v1/projects/{project_id}/playlists")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"My playlist\",\n \"enabled\": true,\n \"type\": \"manual\",\n \"content_limit\": 25,\n \"content\": [\n {\n \"id\": \"d7dfd636-098c-4b1b-83e5-15a3cba5a0bd\"\n },\n {\n \"id\": \"ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0\"\n },\n {\n \"id\": \"1c0274ba-362d-4dea-8a34-5177061bf032\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.beyondwords.io/v1/projects/{project_id}/playlists")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"My playlist\",\n \"enabled\": true,\n \"type\": \"manual\",\n \"content_limit\": 25,\n \"content\": [\n {\n \"id\": \"d7dfd636-098c-4b1b-83e5-15a3cba5a0bd\"\n },\n {\n \"id\": \"ed81a10c-83cd-4b1f-ab43-2aa1b4ffefc0\"\n },\n {\n \"id\": \"1c0274ba-362d-4dea-8a34-5177061bf032\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"title": "My playlist",
"enabled": true,
"type": "manual",
"content_limit": 25,
"content": [
{
"id": "d7dfd636-098c-4b1b-83e5-15a3cba5a0bd",
"status": "processed",
"title": "Content title",
"source_id": "example-source-id",
"source_url": "https://example.com/some-article",
"author": "John Smith",
"image_url": "https://example.com/image.jpeg",
"metadata": {
"key": "value"
},
"audio": [
{
"id": 1,
"content_type": "application/vnd.apple.mpegurl",
"url": "https://example.com/audio.m3u8",
"duration": 10000
},
{
"id": 2,
"content_type": "audio/mpeg,",
"url": "https://example.com/audio.mp3",
"duration": 10000
}
],
"video": [
{
"id": 1,
"content_type": "video/mp4",
"url": "https://example.com/waveform-video.mp4",
"duration": 10000
}
],
"ads_enabled": true,
"created": "2023-01-01 00:00:00 UTC",
"updated": "2023-01-01 00:00:05 UTC"
}
],
"settings": null,
"created": "2023-01-01 00:00:00 UTC",
"updated": "2023-01-01 00:00:05 UTC"
}