Skip to content

Gunucco API

KMY edited this page Jun 3, 2017 · 18 revisions

API List

Server

Getting server version number

GET /api/v1/server/version

Returns ApiMessage object. Server version is returned as message property in that object.

Column Description
Authentication Not need.
Scope -
Server version since 0.1.0

Authorization Management

Getting current user session list

GET /api/v1/auth/list

Returns array of UserSessionData objects.

Column Description
Authentication Requested.
Scope ReadUserIdentity
Server version since 0.2.0

Deleting specific user session

DELETE /api/v1/auth/delete
Parameter Description
id_hash Deleting session hash id

Returns ApiMessage object.

Column Description
Authentication Requested.
Scope WriteUserDangerousIdentity
Server version since 0.2.0

User

Creating new User

POST /api/v1/user/create
Parameter Description
id User text id
password User password

Returns User object.

This call is enabled in Debug mode only.

Column Description
Authentication Not need.
Scope -
Server version since 0.1.0

Getting a User

GET /api/v1/user/{id}
Parameter Description
id User id

Returns User object.

Column Description
Authentication Optional.
Scope Read
Server version since 0.1.0

Getting a User with text id

GET /api/v1/user/{id}/text
Parameter Description
id User text id

Returns User object.

Column Description
Authentication Optional.
Scope Read
Server version since 0.1.0

Deleting current User

DELETE /api/v1/user/delete

Returns ApiMessage object.

Column Description
Authentication Requested.
Scope WriteUserDangerousIdentity
Server version since 0.1.0

Logining with id and password

POST /api/v1/user/login/idandpassword
Parameter Description
id User text id
password User password

Returns AuthorizationToken object.

Column Description
Authentication Not need.
Scope -
Server version since 0.1.0

Getting new oauth code

GET /api/v1/user/login/oauthcode/create
Parameter Description
scope [[Scope

Returns OauthCode object.

Column Description
Authentication Not need.
Scope -
Server version since 0.2.0

Logining with oauth code

POST /api/v1/user/login/oauthcode
Parameter Description
code Oauth code which user authorized with web client.

Returns AuthorizationToken object.

Column Description
Authentication Not need.
Scope -
Server version since 0.2.0

Getting user books

GET /api/v1/user/{id}/books
Parameter Description
id User id

Returns array of Book objects.

Column Description
Authentication Optional.
Scope Read
Server version since 0.1.0

Book

Creating a Book

POST /api/v1/book/create
Parameter Description
name Book name

Returns Book object.

Column Description
Authentication Requested.
Scope Write
Server version since 0.1.0

Getting a Book

GET /api/v1/book/{id}
Parameter Description
id Book id

Returns Book object.

Column Description
Authentication Optional.
Scope Read
Server version since 0.1.0

Getting book chapters

GET /api/v1/book/{id}/chapters
Parameter Description
id Book id

Returns array of Chapter objects contains not only children but grandson or younger chapters.
Results are sorted, but parent-child relationships are ignored and executed by only with order numbers. To account for parent-child relationships, client has to sort the results.

Column Description
Authentication Optional. If authenticated and you have permissions, list contains user-only or private items.
Scope Read
Server version since 0.1.0

Getting book chapters (root only)

GET /api/v1/book/{id}/chapters/root
Parameter Description
id Book id

Returns array of Chapter objects contains root chapters only. Results are sorted.

Column Description
Authentication Optional. If authenticated and you have permissions, list contains user-only or private items.
Scope Read
Server version since 0.1.0

Deleting a Book

DELETE /api/v1/book/delete
Parameter Description
id Book id

Returns ApiMessage object.

Column Description
Authentication Requested.
Scope Write
Server version since 0.1.0

Chapter

Creating a Chapter

POST /api/v1/chapter/create
Parameter Description
name Chapter name
book_id Book id
parent_chapter_id Parent chapter id (optional)

Returns Chapter object.

Column Description
Authentication Requested.
Scope Write
Server version since 0.1.0

Getting a chapter

GET /api/v1/chapter/{id}
Parameter Description
id Chapter id

Returns Chapter object.

Column Description
Authentication Optional. If authenticated and you have permissions, you can get user-only or private chapter.
Scope Read
Server version since 0.1.0

Getting children chapters

GET /api/v1/chapter/{id}/children
Parameter Description
id Parent Chapter id

Returns array of Chapter objects. Results are sorted.

Column Description
Authentication Optional. If authenticated and you have permissions, list contains user-only or private items.
Scope Read
Server version since 0.1.0

Getting contents on a chapter

GET /api/v1/chapter/{id}/contents
Parameter Description
id Chapter id

Returns array of ContentMediaPair objects. Results are sorted.

Column Description
Authentication Optional. If authenticated and you have permissions, you can get contents in private or user-only chapters.
Scope Read
Server version since 0.1.0

Updating a Chapter

PUT /api/v1/chapter/update
Parameter Description
chapter Json string of [[Chapter

Returns Chapter object.

Column Description
Authentication Requested.
Scope Write
Server version since 0.1.0

Deleting a Chapter

DELETE /api/v1/chapter/delete
Parameter Description
id Chapter id

Returns ApiMessage object.

Column Description
Authentication Requested.
Scope Write
Server version since 0.1.0

Content and Media

Creating Text Content

POST /api/v1/content/create/text
Parameter Description
chapter_id Parent Chapter id
text Content text

Returns ContentMediaPair object.

Column Description
Authentication Requested.
Scope Write
Server version since 0.1.0

Creating Html Content

POST /api/v1/content/create/html
Parameter Description
chapter_id Parent Chapter id
html Content html

Returns ContentMediaPair object.

If IsAllowHtmlContent property in appsettings.json is false, this operation will return an error. The property is false by default.

Column Description
Authentication Requested.
Scope Write
Server version since 0.2.0

Creating Image Content

POST /api/v1/content/create/image
Parameter Description
chapter_id Parent Chapter id
source Number of [[MediaSource
extension Which png, jpeg, jpg or gif
data Media file. If source is self, this parameter is needed
data_uri Media uri. If source is outside, this parameter is needed

Returns ContentMediaPair object.

If uploading file, need to use multipart/form-data.

Column Description
Authentication Requested.
Scope Write
Server version since 0.1.0

Getting a Content

GET /api/v1/content/{id}
Parameter Description
id Content id

Returns ContentMediaPair object.

Column Description
Authentication Optional. If authenticated and you have permissions, you can get contents in private or user-only chapters.
Scope Read
Server version since 0.1.0

Updating a Content

PUT /api/v1/content/update
Parameter Description
content Json string of [[Content

Returns ApiMessage object.

Column Description
Authentication Requested.
Scope Write
Server version since 0.1.0

Deleting a Content

DELETE /api/v1/content/delete
Parameter Description
id Content id

Returns ApiMessage object.

Column Description
Authentication Requested.
Scope Write
Server version since 0.1.0

Downloading a Media

GET /api/v1/download/media/{path}
Parameter Description
path Media path

Returns Media corresponding to its format. Apis to get contents return this uri.

Column Description
Authentication Optional. If authenticated and you have permissions, you can get media in private or user-only chapters.
Scope Read
Server version since 0.1.0

Downloading a Media

GET /api/v1/download/media/{path}/token?token={token}
Parameter Description
path Media path
token Access token

Returns Media corresponding to its format.
Authenticated apis which getting contents return this uri.

Column Description
Authentication -
Scope Read
Server version since 0.1.0