API Endpoint - post

  • Endpoint URL: https://api.osbn.io/v1/post.php
  • HTTP Method: POST
  • Headers:
    • Authorization: {token}
    • Content-Type: application/json
    • Testing: true
  • Data (json):
    • bookCountry, title, subtitle, description, author, authordescription, pages, publicationDate, edition, format, genre, genre2, bookLanguage, price, currency, availability, coverImage, linkname1, link1, linkname2, link2, linkname3, link3, linkname4, link4, linkname5, link5, isbn, personalMessage, publishedBy, publisherURL, publisherContactName, publisherContactEmail, publisherDescription

Description:

The post REST API endpoint allows you to apply for an 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 an author image and/or a cover image.

Request Parameters:

Required
  1. Authorization (Header): The authorization header is used to authenticate the request. You should include a valid token to access the API.
  2. bookCountry (Data) int or string: The desired country code for the book. Choose number or name from this list.
  3. title (Data) string
  4. description (Data) string
  5. author (Data) string
  6. pages (Data) integer: a positive number.
  7. publicationDate (Data) date: in this format: 2023-12-31. Do not specify time.
  8. edition (Data) int or string: choose number or name from this list.
  9. format (Data) int or string: choose number or name from this list.
  10. genre (Data) int or string: choose number or name from this list.
  11. bookLanguage (Data) int or string: choose number or name from this list.
  12. publishedBy (Data) string: publisher name
Optional
  1. Testing (Header): If set, then the OSBN record isn't created.
  2. subtitle (Data) string
  3. authordescription (Data) string
  4. genre2 (Data) string: can be more than one if comma-separated.
  5. price (Data) float: can be 9 or 9.99
  6. currency (Data) string: a character, such as: €, $, ¥, and ₹
  7. availability (Data) int or string: choose number or name from this list.
  8. linkname1 (Data) string: such as "Buy Now" or "Author Site" You can supply linkname1 through linkname5.
  9. link1 (Data) string: the link described by its linkname. You can supply link1 through link5. Include the protocol (http:// or https://)
  10. personalMessage (Data) string
  11. publisherURL (Data) string: Include the protocol (http:// or https://)
  12. publisherContactName (Data) string
  13. publisherContactEmail (Data) string: email address
  14. publisherDescription (Data) string
  15. isbn (Data) string

Example 1: cURL Command (using data file):

data.json:
{
    "bookCountry":"Costa Rica",
    "title":"The Book of Arne",
    "subtitle":"A Short European Literary Exposition",
    "author":"Arne Hemingway",
    "description":"With a wicked blend of wit and humor, these sixteen disparate and embellished stories of the Americas and Europe are a veritable
     literary escapade interspersed with hilarious anecdotes, incisive observations, and thoughtful reflections. All are one hundred percent
     true fiction. All sales are final....",
    "pages":"204",
    "publication_date":"2023-10-04",
    "edition":"1",
    "format":"paperback",
    "genre":"Literary Fiction",
    "genre2":"Eclectic, Short Stories",
    "book_language":"English",
    "price":"14.14",
    "currency":"€",
    "availability":"In Stock",
    "link1name":"Buy",
    "link1":"https://www.lulu.com/shop/arne-hemingway/the-book-of-arne/paperback/product-744n5m.html",
    "link2name":"Author Site",
    "link2":"https://arnehemingway.com/books/TheBookOfArne/",
    "message":"Goodbye, cruel world!",
    "publisher_name":"AHEM Books",
    "publisher_url":"https://arnehemingway.com",
    "publisher_contact_name":"Arne Hemingway",
    "publisher_contact_email":"arne@arnehemingway.com",
    "publisher_description":"A small boutique publisher nestled amongst the Himalayan mountaintops.",
    "author_description":"A restless orphan, Arne Hemingway spent his childhood working on his uncle's farm. He longed to
    leave and become a fighter pilot but he lacked the means. Also, he was needed on the farm.  Then in his 20s, the
    innocent act of acquiring two droids from a group of Jawas resulted in his his aunt	and uncle's murder. He found himself
    on a mission to rescue the droids' owner, who was also a beautiful princess, and destroy the Evil Empire's Death Star.
    Hemingway completed the mission successfully by	exploiting an exhaust port defect that quite frankly should have been
    caught in the first round of security testing.
    Mission accomplished, the reclusive Hemingway settled in Europe to write medium-quality short stories, and to continuously
    labor over the first pages of several different novels, all still unfinished.",
}
Command:
curl -X POST https://api.osbn.io/v1/post.php -H "Authorization: Wmp6ADsd8PtWfMODoaYMXNHIjhHA5Ws" -H "Content-Type: application/json" -d @data.json

Example 2: cURL Command (with minimum required data, test mode):

Command:
curl -X POST https://api.osbn.io/v1/post.php \
-H "Authorization: Wmp6ADsd8PtWfMODoaYMXNHIjhHA5Ws" \
-H "Content-Type: application/json" \
-H "Testing: true" \
-d "{\"bookCountry\":\"Cambodia\",\"title\":\"Exterminating Common Pests\",\"description\":\"By simply using clubs and knives and well as common household poisons, you can quickly and permanently rid your home of a variety of household pests, including kittens, puppies, recalcitrant teens, and door-to-door salesmen.The accuracy of this material is not guaranteed. All sales are final.\",\"author\":\"Arne Hemingway\",\"pages\":\"454\",\"publicationDate\":\"2019-01-01\",\"edition\":\"1\",\"format\":\"hardcover\",\"genre\":\"09\",\"bookLanguage\":\"English\",\"publishedBy\":\"AHEM Books\"}"

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":"POST Success!",
		"osbn":"OSBN-01-001-000001-001-4"
	}
	
Response Example (Success (testing mode)):
	{
		"status":"success",
		"message":"POST Success!",
		"osbn":"OSBN-01-001-000001-001-4",
		"Testing":"TRUE"
	}
	
Response Example (Duplicate):
	{
		"status":"error",
		"message":"Duplicate record found."
	}
	
Response Example (Missing required field(s)):
	{
		"status":"error",
		"message":"Missing required fields: bookCountry,pages"
	}