DBooks Backed Documentation 2: Accounts and Create Resource Endpoints

in utopian-io •  4 months ago



Repository

https://github.com/feekayo/dbooks-api

Details

This Documentation describes the Accounts & Create functions and routes of the Dbooks API.

Here, we're trying to provide prospective developers with information about communicating with our WebAPI and some of its functionality (create and accounts functions)

The accounts function endpoints include

  1. https://dbooks-api.herokuapp.com/login
  2. https://dbooks-api.herokuapp.com/logout/:session_id
  3. https://dbooks-api.herokuapp.com/update/pen_name/:session_id

While the create function endpoints include

  1. https://dbooks-api.herokuapp.com/create/book/:session_id
  2. https://dbooks-api.herokuapp.com/create/like/:session_id
  3. https://dbooks-api.herokuapp.com/create/vote/:session_id
  4. https://dbooks-api.herokuapp.com/create/chapter/:session_id
  5. https://dbooks-api.herokuapp.com/create/rental/:session_id
  6. https://dbooks-api.herokuapp.com/create/review/:session_id

Components

There are 4 major http request types used in this project. They include

  1. PUT:- For create requests
  2. POST:- For updates
  3. GET:- For reads
  4. DELETE:- For delete requests

These 4 http requests are used widely in the application.

THE ACCOUNTS FUNCTIONS

The Login Route

This route is used for logging into DBooks, after confirmation of steemconnect login

https://dbooks-api.herokuapp.com/login

This route requires a GET http request. A singular parameter is required

  1. steemit_username

The response expected here include

  1. response data log: holds server message to client
  2. response data success: holds operation success flags; these flags include
    i. 0: Operation failed
    ii. 1: Operation success
  3. response.data.session_id: session id
  4. response data pen_name: pen name of session user
  5. response.data.user_id: user_id of session user

The Logout Route

Used for logging out of dbooks.org
https://dbooks-api.herokuapp.com/logout/:session_id

This route requires a singular POST http request. The parameter required is

1.user_id

The response gotten includes

  1. response.data.log: holds server message to client
  2. response.data.success: holds operation success flags
    i. 0: Operation failed
    ii. 1: Operation success
  3. response.data.session_id: client session id
  4. response.data.pen_name: pen name of session user
  5. response.data.user_id: user_id of session user

The Update Pen name Route

This route is used for updating a user's pen name

https://dbooks-api.herokuapp.com/logout/:session_id

This route requires a POST http request. The parameters required include

  1. user_id
  2. pen_name

The response received contains

  1. response.data.log: holds server message to client
  2. response data success: holds operation success flags
    i. 0: Operation failed
    ii. 1: Operation success
    iii. 2: Operation failed, session reset required

THE CREATE FUNCTIONS

The Create Book Endpoint

This endpoint is used for creating books on the backend.

https://dbooks-api.herokuapp.com/create/book/:session_id

The route requires a PUT http request. The parameters required include

  1. user_id:- The ID of the session user
  2. title:- The Book Title
  3. bucket:- The Amazon bucket where the book cover is saved
  4. object:- The object of book cover
  5. genre:- The Book Genres
  6. synopsis:- A short synopsis of the book
  7. language:- Language book was written in

The responses expected include

  1. response.data.log: holds server message to client
  2. response.data.success: holds operation success flags
    i. 0: Operation failed
    ii. 1: Operation success
    iii. 2: Operation failed; but session reset required

The Create Favorite Endpoint

This endpoint is used for adding books to a user's favorites list

https://dbooks-api.herokuapp.com/create/like/:session_id

This route requires a PUT http request. The parameters required include

  1. book_id:- The ID of book
  2. user_id:- The ID of the session user

The responses expected include

  1. response.data.log: holds server message to client
  2. response.data.success: holds operation success flags
    i. 0: Operation failed
    ii. 1: Operation success
    iii. 2: Operation failed; but session reset required

The Create Chapter Endpoint

This endpoint is used for adding Chapters to a book

https://dbooks-api.herokuapp.com/create/chapter/:session_id

This route requires a PUT http request. The parameters required include

  1. user_id:- The ID of session user
  2. book_id:- The ID of book
  3. chapter_number:- The chapter number of the book
  4. chapter_content:- The Content of the Chapter
  5. steemit_published:- true/false; depending on whether the chapter is to be pushed to the steem blockchain
  6. author: steemit username of book writer
  7. steemit_permlink:- permlink of chapter

The responses expected include

  1. response.data.log: holds server message to client
  2. response.data.success: holds operation success flags
    i. 0: Operation failed
    ii. 1: Operation success
    iii. 2: Operation failed; but session reset required

The Create Vote Endpoint

This endpoint is used for keeping track of votes made on the application

https://dbooks-api.herokuapp.com/create/votes/:session_id

This route requires a PUT http request. The required parameters include

  1. permlink:- Steemit Chapter Permlink
  2. user_id:- The ID of session user

The responses expected include

  1. response.data.log: holds server message to client
  2. response.data.success: holds operation success flags
    i. 0: Operation failed
    ii. 1: Operation success
    iii. 2: Operation failed; but session reset required

The Create Rental Endpoint

This endpoint is used for saving and tracking book rentals

https://dbooks-api.herokuapp.com/create/rental/:session_id

This route requires a PUT http request. The required parameters include

  1. steemit_user_name:- steemit user name of book writer
  2. claim_user_id:- The user id of the book writer
  3. user_id:- The session users user id
  4. book_id:- The book ID of book
  5. price:- Price of book

The responses expected include

  1. response.data.log: holds server message to client
  2. response data success: holds operation success flags
    i. 0: Operation failed
    ii. 1: Operation success
    iii. 2: Operation failed; but session reset required

The Create Review Endpoint

This endpoint is used for creating a review/rating for a book

https://dbooks-api.herokuapp.com/create/review/:session_id

This route requires a PUT http request. These parameters include

  1. author:- steemit user name of book writer
  2. permlink:- review permlink
  3. user_id:- The session users user id
  4. book_id:- The book ID of book
  5. content- Review Content
  6. rating:- Rating

The responses expected include

  1. response.data.log: holds server message to client
  2. response.data.success: holds operation success flags
    i. 0: Operation failed
    ii. 1: Operation success
    iii. 2: Operation failed; but session reset required

Differences.

Addition of new infornation about route endpoints for Accounts and Create functions

Documentation

Official Documentation hosted on:

https://github.com/feekayo/dbooks-api/wiki/Account-Functions

https://github.com/feekayo/dbooks-api/wiki/Create-Functions

Proof of Authorship

.https://github.com/feekayo

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

@feekayo thanks friend information

I would say you to improve on your documentation using better markdown and utilizing tools for documentation like mkdocs, jsdocs or some other.

Please try to bring more quality in contributions.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hey @feekayo
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!