Update viewer settings
PUT
/api/v1/books/{bookId}/viewer-setting
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");curl_easy_setopt(hnd, CURLOPT_URL, "http://127.0.0.1:58259/api/v1/books/1/viewer-setting");
struct curl_slist *headers = NULL;headers = curl_slist_append(headers, "Content-Type: application/json");curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{ \"pdfSettings\": { \"bookId\": 1, \"zoom\": \"example\", \"spread\": \"example\", \"isDarkTheme\": true }, \"newPdfSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"backgroundColor\": \"GRAY\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\" }, \"ebookSettings\": { \"bookId\": 1, \"userId\": 1, \"fontFamily\": \"example\", \"fontSize\": 1, \"gap\": 1, \"hyphenate\": true, \"isDark\": true, \"justify\": true, \"lineHeight\": 1, \"maxBlockSize\": 1, \"maxColumnCount\": 1, \"maxInlineSize\": 1, \"theme\": \"example\", \"flow\": \"example\" }, \"cbxSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\", \"backgroundColor\": \"GRAY\" } }");
CURLcode ret = curl_easy_perform(hnd);using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Put, RequestUri = new Uri("http://127.0.0.1:58259/api/v1/books/1/viewer-setting"), Content = new StringContent("{ \"pdfSettings\": { \"bookId\": 1, \"zoom\": \"example\", \"spread\": \"example\", \"isDarkTheme\": true }, \"newPdfSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"backgroundColor\": \"GRAY\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\" }, \"ebookSettings\": { \"bookId\": 1, \"userId\": 1, \"fontFamily\": \"example\", \"fontSize\": 1, \"gap\": 1, \"hyphenate\": true, \"isDark\": true, \"justify\": true, \"lineHeight\": 1, \"maxBlockSize\": 1, \"maxColumnCount\": 1, \"maxInlineSize\": 1, \"theme\": \"example\", \"flow\": \"example\" }, \"cbxSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\", \"backgroundColor\": \"GRAY\" } }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "http://127.0.0.1:58259/api/v1/books/1/viewer-setting"
payload := strings.NewReader("{ \"pdfSettings\": { \"bookId\": 1, \"zoom\": \"example\", \"spread\": \"example\", \"isDarkTheme\": true }, \"newPdfSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"backgroundColor\": \"GRAY\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\" }, \"ebookSettings\": { \"bookId\": 1, \"userId\": 1, \"fontFamily\": \"example\", \"fontSize\": 1, \"gap\": 1, \"hyphenate\": true, \"isDark\": true, \"justify\": true, \"lineHeight\": 1, \"maxBlockSize\": 1, \"maxColumnCount\": 1, \"maxInlineSize\": 1, \"theme\": \"example\", \"flow\": \"example\" }, \"cbxSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\", \"backgroundColor\": \"GRAY\" } }")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close() body, _ := io.ReadAll(res.Body)
fmt.Println(res) fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("http://127.0.0.1:58259/api/v1/books/1/viewer-setting")) .header("Content-Type", "application/json") .method("PUT", HttpRequest.BodyPublishers.ofString("{ \"pdfSettings\": { \"bookId\": 1, \"zoom\": \"example\", \"spread\": \"example\", \"isDarkTheme\": true }, \"newPdfSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"backgroundColor\": \"GRAY\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\" }, \"ebookSettings\": { \"bookId\": 1, \"userId\": 1, \"fontFamily\": \"example\", \"fontSize\": 1, \"gap\": 1, \"hyphenate\": true, \"isDark\": true, \"justify\": true, \"lineHeight\": 1, \"maxBlockSize\": 1, \"maxColumnCount\": 1, \"maxInlineSize\": 1, \"theme\": \"example\", \"flow\": \"example\" }, \"cbxSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\", \"backgroundColor\": \"GRAY\" } }")) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{ \"pdfSettings\": { \"bookId\": 1, \"zoom\": \"example\", \"spread\": \"example\", \"isDarkTheme\": true }, \"newPdfSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"backgroundColor\": \"GRAY\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\" }, \"ebookSettings\": { \"bookId\": 1, \"userId\": 1, \"fontFamily\": \"example\", \"fontSize\": 1, \"gap\": 1, \"hyphenate\": true, \"isDark\": true, \"justify\": true, \"lineHeight\": 1, \"maxBlockSize\": 1, \"maxColumnCount\": 1, \"maxInlineSize\": 1, \"theme\": \"example\", \"flow\": \"example\" }, \"cbxSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\", \"backgroundColor\": \"GRAY\" } }");Request request = new Request.Builder() .url("http://127.0.0.1:58259/api/v1/books/1/viewer-setting") .put(body) .addHeader("Content-Type", "application/json") .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = { method: 'PUT', url: 'http://127.0.0.1:58259/api/v1/books/1/viewer-setting', headers: {'Content-Type': 'application/json'}, data: { pdfSettings: {bookId: 1, zoom: 'example', spread: 'example', isDarkTheme: true}, newPdfSettings: { bookId: 1, pageSpread: 'EVEN', pageViewMode: 'SINGLE_PAGE', backgroundColor: 'GRAY', fitMode: 'ACTUAL_SIZE', scrollMode: 'PAGINATED' }, ebookSettings: { bookId: 1, userId: 1, fontFamily: 'example', fontSize: 1, gap: 1, hyphenate: true, isDark: true, justify: true, lineHeight: 1, maxBlockSize: 1, maxColumnCount: 1, maxInlineSize: 1, theme: 'example', flow: 'example' }, cbxSettings: { bookId: 1, pageSpread: 'EVEN', pageViewMode: 'SINGLE_PAGE', fitMode: 'ACTUAL_SIZE', scrollMode: 'PAGINATED', backgroundColor: 'GRAY' } }};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'http://127.0.0.1:58259/api/v1/books/1/viewer-setting';const options = { method: 'PUT', headers: {'Content-Type': 'application/json'}, body: '{"pdfSettings":{"bookId":1,"zoom":"example","spread":"example","isDarkTheme":true},"newPdfSettings":{"bookId":1,"pageSpread":"EVEN","pageViewMode":"SINGLE_PAGE","backgroundColor":"GRAY","fitMode":"ACTUAL_SIZE","scrollMode":"PAGINATED"},"ebookSettings":{"bookId":1,"userId":1,"fontFamily":"example","fontSize":1,"gap":1,"hyphenate":true,"isDark":true,"justify":true,"lineHeight":1,"maxBlockSize":1,"maxColumnCount":1,"maxInlineSize":1,"theme":"example","flow":"example"},"cbxSettings":{"bookId":1,"pageSpread":"EVEN","pageViewMode":"SINGLE_PAGE","fitMode":"ACTUAL_SIZE","scrollMode":"PAGINATED","backgroundColor":"GRAY"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")val body = RequestBody.create(mediaType, "{ \"pdfSettings\": { \"bookId\": 1, \"zoom\": \"example\", \"spread\": \"example\", \"isDarkTheme\": true }, \"newPdfSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"backgroundColor\": \"GRAY\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\" }, \"ebookSettings\": { \"bookId\": 1, \"userId\": 1, \"fontFamily\": \"example\", \"fontSize\": 1, \"gap\": 1, \"hyphenate\": true, \"isDark\": true, \"justify\": true, \"lineHeight\": 1, \"maxBlockSize\": 1, \"maxColumnCount\": 1, \"maxInlineSize\": 1, \"theme\": \"example\", \"flow\": \"example\" }, \"cbxSettings\": { \"bookId\": 1, \"pageSpread\": \"EVEN\", \"pageViewMode\": \"SINGLE_PAGE\", \"fitMode\": \"ACTUAL_SIZE\", \"scrollMode\": \"PAGINATED\", \"backgroundColor\": \"GRAY\" } }")val request = Request.Builder() .url("http://127.0.0.1:58259/api/v1/books/1/viewer-setting") .put(body) .addHeader("Content-Type", "application/json") .build()
val response = client.newCall(request).execute()use std::str::FromStr;use serde_json::json;use reqwest;
#[tokio::main]pub async fn main() { let url = "http://127.0.0.1:58259/api/v1/books/1/viewer-setting";
let payload = json!({ "pdfSettings": json!({ "bookId": 1, "zoom": "example", "spread": "example", "isDarkTheme": true }), "newPdfSettings": json!({ "bookId": 1, "pageSpread": "EVEN", "pageViewMode": "SINGLE_PAGE", "backgroundColor": "GRAY", "fitMode": "ACTUAL_SIZE", "scrollMode": "PAGINATED" }), "ebookSettings": json!({ "bookId": 1, "userId": 1, "fontFamily": "example", "fontSize": 1, "gap": 1, "hyphenate": true, "isDark": true, "justify": true, "lineHeight": 1, "maxBlockSize": 1, "maxColumnCount": 1, "maxInlineSize": 1, "theme": "example", "flow": "example" }), "cbxSettings": json!({ "bookId": 1, "pageSpread": "EVEN", "pageViewMode": "SINGLE_PAGE", "fitMode": "ACTUAL_SIZE", "scrollMode": "PAGINATED", "backgroundColor": "GRAY" }) });
let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::Client::new(); let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url) .headers(headers) .json(&payload) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request PUT \ --url http://127.0.0.1:58259/api/v1/books/1/viewer-setting \ --header 'Content-Type: application/json' \ --data '{ "pdfSettings": { "bookId": 1, "zoom": "example", "spread": "example", "isDarkTheme": true }, "newPdfSettings": { "bookId": 1, "pageSpread": "EVEN", "pageViewMode": "SINGLE_PAGE", "backgroundColor": "GRAY", "fitMode": "ACTUAL_SIZE", "scrollMode": "PAGINATED" }, "ebookSettings": { "bookId": 1, "userId": 1, "fontFamily": "example", "fontSize": 1, "gap": 1, "hyphenate": true, "isDark": true, "justify": true, "lineHeight": 1, "maxBlockSize": 1, "maxColumnCount": 1, "maxInlineSize": 1, "theme": "example", "flow": "example" }, "cbxSettings": { "bookId": 1, "pageSpread": "EVEN", "pageViewMode": "SINGLE_PAGE", "fitMode": "ACTUAL_SIZE", "scrollMode": "PAGINATED", "backgroundColor": "GRAY" } }'wget --quiet \ --method PUT \ --header 'Content-Type: application/json' \ --body-data '{ "pdfSettings": { "bookId": 1, "zoom": "example", "spread": "example", "isDarkTheme": true }, "newPdfSettings": { "bookId": 1, "pageSpread": "EVEN", "pageViewMode": "SINGLE_PAGE", "backgroundColor": "GRAY", "fitMode": "ACTUAL_SIZE", "scrollMode": "PAGINATED" }, "ebookSettings": { "bookId": 1, "userId": 1, "fontFamily": "example", "fontSize": 1, "gap": 1, "hyphenate": true, "isDark": true, "justify": true, "lineHeight": 1, "maxBlockSize": 1, "maxColumnCount": 1, "maxInlineSize": 1, "theme": "example", "flow": "example" }, "cbxSettings": { "bookId": 1, "pageSpread": "EVEN", "pageViewMode": "SINGLE_PAGE", "fitMode": "ACTUAL_SIZE", "scrollMode": "PAGINATED", "backgroundColor": "GRAY" } }' \ --output-document \ - http://127.0.0.1:58259/api/v1/books/1/viewer-settingUpdate viewer settings for a specific book.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” bookId
required
integer format: int64
ID of the book
Request Body required
Section titled “Request Body required ” Media type application/json
Viewer settings to update
object
pdfSettings
object
bookId
integer format: int64
zoom
string
spread
string
isDarkTheme
boolean
newPdfSettings
object
bookId
integer format: int64
pageSpread
string
pageViewMode
string
backgroundColor
string
fitMode
string
scrollMode
string
ebookSettings
object
bookId
integer format: int64
userId
integer format: int64
fontFamily
string
fontSize
integer format: int32
gap
number format: float
hyphenate
boolean
isDark
boolean
justify
boolean
lineHeight
number format: float
maxBlockSize
integer format: int32
maxColumnCount
integer format: int32
maxInlineSize
integer format: int32
theme
string
flow
string
cbxSettings
object
bookId
integer format: int64
pageSpread
string
pageViewMode
string
fitMode
string
scrollMode
string
backgroundColor
string
Responses
Section titled “ Responses ”Viewer settings updated successfully