Deactivate a book
curl --request PATCH \
--url https://bookhub-mock.onrender.com/books/{bookId}/deactivate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"notes": "Removed due to publisher request"
}
'import requests
url = "https://bookhub-mock.onrender.com/books/{bookId}/deactivate"
payload = { "notes": "Removed due to publisher request" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({notes: 'Removed due to publisher request'})
};
fetch('https://bookhub-mock.onrender.com/books/{bookId}/deactivate', 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://bookhub-mock.onrender.com/books/{bookId}/deactivate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'notes' => 'Removed due to publisher request'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://bookhub-mock.onrender.com/books/{bookId}/deactivate"
payload := strings.NewReader("{\n \"notes\": \"Removed due to publisher request\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://bookhub-mock.onrender.com/books/{bookId}/deactivate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"notes\": \"Removed due to publisher request\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://bookhub-mock.onrender.com/books/{bookId}/deactivate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"notes\": \"Removed due to publisher request\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Book deactivated successfully",
"data": {
"bookId": "123e4567-e89b-41d4-a716-426614174000",
"title": "The Great Adventure",
"status": "INACTIVE",
"updatedDate": "2024-12-26T15:45:00Z"
}
}{
"status": "error",
"message": "Validation failed",
"errors": [
{
"field": "notes",
"error": "MAX_LENGTH_EXCEEDED",
"description": "notes must not exceed 1000 characters",
"validation_context": {
"rule": "max_length",
"constraint": {
"maxLength": 1000
},
"provided_value": "<1247 characters>"
}
}
]
}{
"status": "error",
"message": "Authentication failed",
"errors": [
{
"field": "Authorization",
"error": "INVALID_TOKEN",
"description": "The JWT is missing, malformed, or expired. Obtain a new token and retry."
}
]
}{
"status": "error",
"message": "Book not found",
"errors": [
{
"field": "bookId",
"error": "NOT_FOUND",
"description": "No book exists with bookId 123e4567-e89b-41d4-a716-426614174000"
}
]
}{
"status": "error",
"message": "Rate limit exceeded. Retry after the window resets (see X-RateLimit-Reset header)."
}Endpoints
Deactivate a book
Changes a book’s status from ACTIVE to INACTIVE, removing it from
customer visibility without deleting it. Deactivation is a required
precondition for deleting a book.
PATCH
/
books
/
{bookId}
/
deactivate
Deactivate a book
curl --request PATCH \
--url https://bookhub-mock.onrender.com/books/{bookId}/deactivate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"notes": "Removed due to publisher request"
}
'import requests
url = "https://bookhub-mock.onrender.com/books/{bookId}/deactivate"
payload = { "notes": "Removed due to publisher request" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({notes: 'Removed due to publisher request'})
};
fetch('https://bookhub-mock.onrender.com/books/{bookId}/deactivate', 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://bookhub-mock.onrender.com/books/{bookId}/deactivate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'notes' => 'Removed due to publisher request'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://bookhub-mock.onrender.com/books/{bookId}/deactivate"
payload := strings.NewReader("{\n \"notes\": \"Removed due to publisher request\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
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.patch("https://bookhub-mock.onrender.com/books/{bookId}/deactivate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"notes\": \"Removed due to publisher request\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://bookhub-mock.onrender.com/books/{bookId}/deactivate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"notes\": \"Removed due to publisher request\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Book deactivated successfully",
"data": {
"bookId": "123e4567-e89b-41d4-a716-426614174000",
"title": "The Great Adventure",
"status": "INACTIVE",
"updatedDate": "2024-12-26T15:45:00Z"
}
}{
"status": "error",
"message": "Validation failed",
"errors": [
{
"field": "notes",
"error": "MAX_LENGTH_EXCEEDED",
"description": "notes must not exceed 1000 characters",
"validation_context": {
"rule": "max_length",
"constraint": {
"maxLength": 1000
},
"provided_value": "<1247 characters>"
}
}
]
}{
"status": "error",
"message": "Authentication failed",
"errors": [
{
"field": "Authorization",
"error": "INVALID_TOKEN",
"description": "The JWT is missing, malformed, or expired. Obtain a new token and retry."
}
]
}{
"status": "error",
"message": "Book not found",
"errors": [
{
"field": "bookId",
"error": "NOT_FOUND",
"description": "No book exists with bookId 123e4567-e89b-41d4-a716-426614174000"
}
]
}{
"status": "error",
"message": "Rate limit exceeded. Retry after the window resets (see X-RateLimit-Reset header)."
}Authorizations
JWT obtained from the authentication endpoint
Path Parameters
Unique identifier of the book to deactivate
Body
application/json
Optional deactivation metadata
Internal notes about the deactivation
Maximum string length:
1000Example:
"Removed due to publisher request"
Last modified on July 25, 2026