API Endpoint - modify
- Endpoint URL:
https://api.osbn.io/v1/modify.php
- HTTP Method: POST
- Headers:
- Authorization: {token}
- Content-Type: application/json
- OSBN: {OSBN}
- Testing: true
- Data (json):
- author_description, genre2, price, currency, availability, linkname1, link1, linkname2, link2, linkname3, link3, linkname4, link4, linkname5, link5, isbn, message, publisherURL, publisherContactName, publisherContactEmail, publisherDescription
Description:
The modify REST API endpoint allows you to modify many fields of an existing OSBN by making a POST request. Note that this method can accept all possible record fields except for author image and cover image. A different request method (postimages) is required to submit or update an author image and/or a cover image.
Notes:
- The OSBN record must already exist.
- At least one data field must be specified.
- Maximum field size is: 1000 characters for description fields, and 255 characters for all others.
- Modifying a record changes its status back to 'pending approval'.
Request Parameters:
- Authorization (Header): The authorization header is used to authenticate the request. You should include a valid token to access the API.
- Content-Type (Header): specifies that the content will be in a certain format
- OSBN (Header): The OSBN to update in expanded format. (for example, OSBN-01-001-000001-001-4)
- Optional: Testing (Header): If set, then the OSBN record isn't altered.
and at least one of the below is required:
- authordescription (Data) string
- genre2 (Data) string: can be more than one if comma-separated.
- price (Data) float: can be 9 or 9.99
- currency (Data) string: a character, such as: €, $, ¥, and ₹
- availability (Data) int or string: choose number or name from this list.
- linknameX (Data) string: such as "Buy Now" or "Author Site" You can supply linkname1 through linkname5.
- linkX (Data) string: the link described by its linkname. You can supply link1 through link5. Include the protocol (http:// or https://)
- isbn (Data) string
- message (Data) string
- publisherURL (Data) string: Include the protocol (http:// or https://)
- publisherContactName (Data) string
- publisherContactEmail (Data) string: email address
- publisherDescription (Data) string
Example 1: cURL Command:
curl -X POST https://api.osbn.io/v1/modify.php \
-H "Authorization: Wmp6ADsd8PtWfMODoaYMXNHIjhHA5Ws" \
-H "Content-Type: application/json" \
-H "OSBN: OSBN-01-001-000001-001-4" \
-d "{\"author_description\":\"Ribald and charming, Arne Hemingway fears most social situations.\",\"price\":\"19.99\"}"
Example 2: cURL Command: (test mode)
curl -X POST https://api.osbn.io/v1/modify.php \
-H "Authorization: Wmp6ADsd8PtWfMODoaYMXNHIjhHA5Ws"
-H "Content-Type: application/json"
-H "OSBN: OSBN-01-001-000001-001-4"
-H "Testing: true"
-d "{\"message\":\"You complete me. By 'you' I mean 'my readers'. By 'my readers', I mean 'me'.\",\"availability\":\"3\"}"
Responses:
- If the POSTed data is accepted and the provided token is valid, you will receive a JSON response containing the book's OSBN.
- If the request is unauthorized or if the data is not accepted, appropriate error responses will be provided.
Response Example (Success):
{
"status":"success",
"message":"MODIFY Success!",
"osbn":"OSBN-01-001-000001-001-4"
}
Response Example (Invalid OSBN (or an OSBN that you don't own)):
{
"status":"error",
"message":"OSBN not found."
}
Response Example (Submission of duplicate data):
{
"status":"error",
"message":"Nothing to update."
}
Response Example (Modifying an already modified record):
{
"status":"error",
"message":"This book is pending approval."
}