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:

  1. The OSBN record must already exist.
  2. At least one data field must be specified.
  3. Maximum field size is: 1000 characters for description fields, and 255 characters for all others.
  4. Modifying a record changes its status back to 'pending approval'.

Request Parameters:

  1. Authorization (Header): The authorization header is used to authenticate the request. You should include a valid token to access the API.
  2. Content-Type (Header): specifies that the content will be in a certain format
  3. OSBN (Header): The OSBN to update in expanded format. (for example, OSBN-01-001-000001-001-4)
  4. Optional: Testing (Header): If set, then the OSBN record isn't altered.
  5. and at least one of the below is required:
  6. authordescription (Data) string
  7. genre2 (Data) string: can be more than one if comma-separated.
  8. price (Data) float: can be 9 or 9.99
  9. currency (Data) string: a character, such as: €, $, ¥, and ₹
  10. availability (Data) int or string: choose number or name from this list.
  11. linknameX (Data) string: such as "Buy Now" or "Author Site" You can supply linkname1 through linkname5.
  12. linkX (Data) string: the link described by its linkname. You can supply link1 through link5. Include the protocol (http:// or https://)
  13. isbn (Data) string
  14. message (Data) string
  15. publisherURL (Data) string: Include the protocol (http:// or https://)
  16. publisherContactName (Data) string
  17. publisherContactEmail (Data) string: email address
  18. 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."
	}