Idempotently insert up to 100 history items
curl --request POST \
--url https://punchplay.tv/api/platform/v1/sync/history \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"items": [
{
"client_item_id": "<string>",
"tmdb_id": 2,
"title": "<string>",
"year": 1994,
"watched_at": "2023-11-07T05:31:56Z",
"season": 1,
"episode": 2,
"episode_title": "<string>",
"poster_path": "<string>",
"still_path": "<string>",
"runtime_minutes": 2
}
]
}
'import requests
url = "https://punchplay.tv/api/platform/v1/sync/history"
payload = { "items": [
{
"client_item_id": "<string>",
"tmdb_id": 2,
"title": "<string>",
"year": 1994,
"watched_at": "2023-11-07T05:31:56Z",
"season": 1,
"episode": 2,
"episode_title": "<string>",
"poster_path": "<string>",
"still_path": "<string>",
"runtime_minutes": 2
}
] }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
items: [
{
client_item_id: '<string>',
tmdb_id: 2,
title: '<string>',
year: 1994,
watched_at: '2023-11-07T05:31:56Z',
season: 1,
episode: 2,
episode_title: '<string>',
poster_path: '<string>',
still_path: '<string>',
runtime_minutes: 2
}
]
})
};
fetch('https://punchplay.tv/api/platform/v1/sync/history', 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://punchplay.tv/api/platform/v1/sync/history",
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([
'items' => [
[
'client_item_id' => '<string>',
'tmdb_id' => 2,
'title' => '<string>',
'year' => 1994,
'watched_at' => '2023-11-07T05:31:56Z',
'season' => 1,
'episode' => 2,
'episode_title' => '<string>',
'poster_path' => '<string>',
'still_path' => '<string>',
'runtime_minutes' => 2
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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://punchplay.tv/api/platform/v1/sync/history"
payload := strings.NewReader("{\n \"items\": [\n {\n \"client_item_id\": \"<string>\",\n \"tmdb_id\": 2,\n \"title\": \"<string>\",\n \"year\": 1994,\n \"watched_at\": \"2023-11-07T05:31:56Z\",\n \"season\": 1,\n \"episode\": 2,\n \"episode_title\": \"<string>\",\n \"poster_path\": \"<string>\",\n \"still_path\": \"<string>\",\n \"runtime_minutes\": 2\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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://punchplay.tv/api/platform/v1/sync/history")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"client_item_id\": \"<string>\",\n \"tmdb_id\": 2,\n \"title\": \"<string>\",\n \"year\": 1994,\n \"watched_at\": \"2023-11-07T05:31:56Z\",\n \"season\": 1,\n \"episode\": 2,\n \"episode_title\": \"<string>\",\n \"poster_path\": \"<string>\",\n \"still_path\": \"<string>\",\n \"runtime_minutes\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://punchplay.tv/api/platform/v1/sync/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"client_item_id\": \"<string>\",\n \"tmdb_id\": 2,\n \"title\": \"<string>\",\n \"year\": 1994,\n \"watched_at\": \"2023-11-07T05:31:56Z\",\n \"season\": 1,\n \"episode\": 2,\n \"episode_title\": \"<string>\",\n \"poster_path\": \"<string>\",\n \"still_path\": \"<string>\",\n \"runtime_minutes\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"client_item_id": "<string>",
"index": 1,
"id": 2,
"error": "<string>"
}
],
"inserted": 1,
"updated": 1,
"removed": 1,
"skipped": 1,
"invalid": 1,
"idempotency_replayed": true
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}Sync
Idempotently insert up to 100 history items
POST
/
api
/
platform
/
v1
/
sync
/
history
Idempotently insert up to 100 history items
curl --request POST \
--url https://punchplay.tv/api/platform/v1/sync/history \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"items": [
{
"client_item_id": "<string>",
"tmdb_id": 2,
"title": "<string>",
"year": 1994,
"watched_at": "2023-11-07T05:31:56Z",
"season": 1,
"episode": 2,
"episode_title": "<string>",
"poster_path": "<string>",
"still_path": "<string>",
"runtime_minutes": 2
}
]
}
'import requests
url = "https://punchplay.tv/api/platform/v1/sync/history"
payload = { "items": [
{
"client_item_id": "<string>",
"tmdb_id": 2,
"title": "<string>",
"year": 1994,
"watched_at": "2023-11-07T05:31:56Z",
"season": 1,
"episode": 2,
"episode_title": "<string>",
"poster_path": "<string>",
"still_path": "<string>",
"runtime_minutes": 2
}
] }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
items: [
{
client_item_id: '<string>',
tmdb_id: 2,
title: '<string>',
year: 1994,
watched_at: '2023-11-07T05:31:56Z',
season: 1,
episode: 2,
episode_title: '<string>',
poster_path: '<string>',
still_path: '<string>',
runtime_minutes: 2
}
]
})
};
fetch('https://punchplay.tv/api/platform/v1/sync/history', 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://punchplay.tv/api/platform/v1/sync/history",
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([
'items' => [
[
'client_item_id' => '<string>',
'tmdb_id' => 2,
'title' => '<string>',
'year' => 1994,
'watched_at' => '2023-11-07T05:31:56Z',
'season' => 1,
'episode' => 2,
'episode_title' => '<string>',
'poster_path' => '<string>',
'still_path' => '<string>',
'runtime_minutes' => 2
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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://punchplay.tv/api/platform/v1/sync/history"
payload := strings.NewReader("{\n \"items\": [\n {\n \"client_item_id\": \"<string>\",\n \"tmdb_id\": 2,\n \"title\": \"<string>\",\n \"year\": 1994,\n \"watched_at\": \"2023-11-07T05:31:56Z\",\n \"season\": 1,\n \"episode\": 2,\n \"episode_title\": \"<string>\",\n \"poster_path\": \"<string>\",\n \"still_path\": \"<string>\",\n \"runtime_minutes\": 2\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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://punchplay.tv/api/platform/v1/sync/history")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"items\": [\n {\n \"client_item_id\": \"<string>\",\n \"tmdb_id\": 2,\n \"title\": \"<string>\",\n \"year\": 1994,\n \"watched_at\": \"2023-11-07T05:31:56Z\",\n \"season\": 1,\n \"episode\": 2,\n \"episode_title\": \"<string>\",\n \"poster_path\": \"<string>\",\n \"still_path\": \"<string>\",\n \"runtime_minutes\": 2\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://punchplay.tv/api/platform/v1/sync/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"items\": [\n {\n \"client_item_id\": \"<string>\",\n \"tmdb_id\": 2,\n \"title\": \"<string>\",\n \"year\": 1994,\n \"watched_at\": \"2023-11-07T05:31:56Z\",\n \"season\": 1,\n \"episode\": 2,\n \"episode_title\": \"<string>\",\n \"poster_path\": \"<string>\",\n \"still_path\": \"<string>\",\n \"runtime_minutes\": 2\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"client_item_id": "<string>",
"index": 1,
"id": 2,
"error": "<string>"
}
],
"inserted": 1,
"updated": 1,
"removed": 1,
"skipped": 1,
"invalid": 1,
"idempotency_replayed": true
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}{
"error": "<string>",
"message": "<string>",
"request_id": "<string>",
"required_scope": "<string>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Headers
Required string length:
8 - 200Body
application/json
Required array length:
1 - 100 elementsShow child attributes
Show child attributes
Page through the current state of one sync resource
Previous
Idempotently update up to 100 ratings or title interactions
Next
⌘I