Skip to content
Leyth Adan edited this page Jan 23, 2019 · 11 revisions

MerryFairyTales API

The Merry Fairy Tales API

Version: 1.0

License:

Find more info here

Security


Oauth Security

oauth2 OAuth 2.0
Flow accessCode
Authorization URL https://accounts.google.com/o/oauth2/v2/auth
Token URL https://www.googleapis.com/oauth2/v4/token
Scopes
admin Admin scope
user User scope

/api/v1/books


POST

Summary: Upload a new book.

Description: Uploads a new book to Merry Fairy Tales. The initial upload includes basic information about the book and the cover page image. Upload of the pages for the book is handled by the uploadPage operation.

Parameters

Name Located in Description Required Schema
title formData The title of the book. Yes string
description formData A brief description of the book. No string
author formData The author of the book. No string
languages formData The languages the book is available in. Yes [ string ]
pageCount formData The page count. No integer
bookCover formData Book cover image. No file

Responses

Code Description Schema
200 Book successfully uploaded. BookUploadedResponse
400 Could not complete request. Missing or invalid information provided.
401 Unauthorized access.
500 A system error occurred.
GET

Summary: Download all books.

Description: Returns an array of all books.

Responses

Code Description Schema
200 Books successfully downloaded. [ Book ]
400 Could not complete request. Missing or invalid information provided.
401 Unauthorized access.
500 A system error occurred.

/api/v1/books/{bookId}


GET

Summary: Download a book.

Description: Downloads all the data for a book, including the paths for the image, text, and audio files for all language versions of the book.

Parameters

Name Located in Description Required Schema
bookId path The book ID. Yes string

Responses

Code Description Schema
200 Book successfully downloaded. Book
400 Could not complete request.
401 Unauthorized access.
404 Book ID not found.
500 A system error occurred.
PUT

Summary: Edit a book.

Description: Edits the basic information about a book, including cover image. Fields left blank will keep their existing values. Editing of pages is handled by the editPage operation.

Parameters

Name Located in Description Required Schema
bookId path The book ID. Yes string
title formData The title of the book. No string
description formData A brief description of the book. No string
author formData The author of the book. No string
languages formData The languages the book is available in. No [ string ]
pageCount formData The page count. No integer
bookCover formData Book cover image. No file

Responses

Code Description Schema
200 Book successfully updated. Book
400 Could not complete request. Missing or invalid information provided.
401 Unauthorized access.
404 Book ID not found.
500 A system error occurred.
DELETE

Summary: Delete a book.

Description: Deletes the book entirely, including the book information, images, text, and audio files for all languages.

Parameters

Name Located in Description Required Schema
bookId path The book ID. Yes string

Responses

Code Description
200 Book deleted.
400 Could not complete request. Missing or invalid information provided.
401 Unauthorized access.
404 Book ID not found.
500 A system error occurred.

/api/v1/books/{bookId}/pages


POST

Summary: Upload a new page.

Description: Uploads a new page for a book in the specified language.

Parameters

Name Located in Description Required Schema
bookId path The book ID. Yes string
language query The language. Yes string
pageNumber formData The page number. Yes integer
pageImage formData Page image. Yes file
pageText formData Page text. Yes file
pageAudio formData Page audio. Yes file

Responses

Code Description Schema
200 Page successfully uploaded. Page
400 Could not complete request. Missing or invalid information provided.
401 Unauthorized access.
404 Book ID not found.
500 A system error occurred.
GET

Summary: Download all pages.

Description: Downloads all of the pages of a book in the specified language. Returns an array of pages.

Parameters

Name Located in Description Required Schema
bookId path The book ID. Yes string
language query The language. Yes string

Responses

Code Description Schema
200 Pages successfully downloaded. [ Page ]
400 Could not complete request.
401 Unauthorized access.
404 Book ID not found.
500 A system error occurred.
DELETE

Summary: Delete all pages for specified language.

Description: Deletes all pages of a book in the specifed language.

Parameters

Name Located in Description Required Schema
bookId path The book ID. Yes string
language query The language. Yes string

Responses

Code Description
200 All pages for specified language deleted.
400 Could not complete request. Missing or invalid information provided.
401 Unauthorized access.
404 Book ID not found.
500 A system error occurred.

/api/v1/books/{bookId}/pages/{pageNumber}


GET

Summary: Download a page.

Description: Downloads a page of a book in the specified language.

Parameters

Name Located in Description Required Schema
bookId path The book ID. Yes string
pageNumber path The page number. Yes integer
language query The language. Yes string

Responses

Code Description Schema
200 Page successfully downloaded. Page
400 Could not complete request.
401 Unauthorized access.
404 Page not found.
500 A system error occurred.
PUT

Summary: Edit a page.

Description: Edits a page for a book in the specified language. Only fields for which a file is uploaded will be updated.

Parameters

Name Located in Description Required Schema
bookId path The book ID. Yes string
pageNumber path The page number. Yes integer
language query The language. Yes string
pageImage formData Page image. No file
pageText formData Page text. No file
pageAudio formData Page audio. No file

Responses

Code Description Schema
200 Page successfully updated. Page
400 Could not complete request. Missing or invalid information provided.
401 Unauthorized access.
404 Page not found.
500 A system error occurred.
DELETE

Summary: Delete a page.

Description: Deletes a page of a book in the specifed language.

Parameters

Name Located in Description Required Schema
bookId path The book ID. Yes string
pageNumber path The page number. Yes integer
language query The language. Yes string

Responses

Code Description
200 Page deleted.
400 Could not complete request. Missing or invalid information provided.
401 Unauthorized access.
404 Page not found.
500 A system error occurred.

/api/v1/books/search


GET

Summary: Search books.

Description: Returns an array of books based on a keyword search.

Parameters

Name Located in Description Required Schema
keywords query Keywords to search for. Yes [ string ]

Responses

Code Description Schema
200 Successful operation. [ Book ]
400 Could not complete request. Missing or invalid information provided.
401 Unauthorized access.
500 A system error occurred.

Models


Book

Name Type Description Required
id string (uuid) No
title string No
description string No
author string No
languages Language No

Language

Name Type Description Required
language string No
pages Page No

Page

Name Type Description Required
pageNumber integer No
imageUrl string No
text_url string No
audio_url string No

BookUploadedResponse

Name Type Description Required
title string No
bookId string (uuid) The ID for the uploaded book. No

Clone this wiki locally