Skip to main content
PUT
/
projects
/
{project_id}
/
playlists
/
{id}
Update playlist
curl --request PUT \
  --url https://api.beyondwords.io/v1/projects/{project_id}/playlists/{id} \
  --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/{id}"

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.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
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/{id}', 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/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
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/{id}"

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("PUT", 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.put("https://api.beyondwords.io/v1/projects/{project_id}/playlists/{id}")
.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/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.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"
}

Authorizations

X-Api-Key
string
header
required

Path Parameters

project_id
string
required

The numeric ID of your project

id
string
required

The numeric ID of your playlist

Body

application/json
title
string
required

The title of the playlist

type
enum<string>
required

The type of playlist. The project type is generated automatically. The manual and auto can set content and rules respectively

Available options:
project,
manual,
auto
enabled
boolean

Whether the playlist can be played in the BeyondWords player

rules_version
enum<string> | null
Available options:
1
rules
object[]

The rules that will be used to find content for 'auto' playlists

content
object[]

The IDs of content to include in the manual playlist

image_url
string | null

The image URL of the playlist

Response

200 - application/json

successful

id
integer

Unique identifier for the object

title
string

The title of the playlist

enabled
boolean

Whether the playlist can be played in the BeyondWords player

type
enum<string>

The type of playlist. The project type is generated automatically. The manual and auto can set content and rules respectively

Available options:
project,
manual,
auto
rules_version
enum<string> | null
Available options:
1
rules
object[]

The rules that will be used to find content for auto playlists

content_limit
integer

The maximum number of content items that will appear in the playlist

content
object[]

The content of the playlist (a reduced set of fields are returned). Only the id field is returned for the playlists index endpoint

created
string<date-time>

Time at which the object was created (ISO 8601)

settings
object | null
updated
string<date-time>

Time at which the object was updated (ISO 8601)