Boghche another but complete RESTful CMS¶
Boghche is another but complete cms. Its server is written in python and has Vue + Nuxt, iOS and Android clients. Currently it has a complete blog and a complete eCommerce. Its goal is to make costumization very easy and simple.
Restful APIs¶
Authentication¶
Objects¶
Object are json objects.
- Permission
name: Name of the permission to display it. code_name: the code for the permission.
- Group
id: ID of the group in database. name: Name of the group to display it. permissions: List of permission object.
- User
id: ID of the user in database. first_name: First name of the user. last_name: Last name of the user. email: email of the user.
- Access
- At login API, if the user is staffmember or admin we have such an object.
group: The group object which user is member of it. is_admin: If the user is admin then its true. is_staff: If the user is staffmember then its true.
Errors¶
If a token needs to be refreshed:
status_code: | 401 |
---|---|
response: | {"message": "Fresh token required"}
|
Invalid token:
status_code: | 422 |
---|---|
response: | {"message": "reason"}
|
Expired token:
status_code: | 401 |
---|---|
response: | {"message": "Token has expired"}
|
Revoked token:
status_code: | 401 |
---|---|
response: | {"message":"Token has been revoked"}
|
application/json
Registration API¶
-
class
fardel.core.auth.views.
RegistrationApi
[source]¶ URL: /api/auth/register/
-
post
()[source]¶ Required arguments: - password
Optional arguments: - first_name
- last_name
Response: { "message":"Successfully registered", "access_token":"access_token", "refresh_token":"refresh_token" }
Errors: if email or password does not provided:
status_code: 400
response: {"message":"Unvalid form submitted"}
If email already exists:
status_code: 409
response: {"message": "A user with this email already exists."}
-
Login API¶
-
class
fardel.core.auth.views.
LoginApi
[source]¶ URL: /api/auth/login/
-
post
()[source]¶ Required arguments: - password
Response: { "message":"Successfully registered", "access_token":"access_token", "refresh_token":"refresh_token", "access": AccessObject }
Errors: if email or password does not provided:
status_code: 400
response: {"message":"Unvalid form submitted"}
If email or password is not correct:
status_code: 401
response: {"message":"Username or password is not correct"}
-
Logout API¶
Logout Refresh Token API¶
Refresh Token API¶
Blog¶
Objects¶
- Category
id: ID for the category in database. name: Name of the category to display. posts:
- Post
id: ID for the post in database. title: content: allow_comment: category: image: comments_count: tags: create_time: update_time: summarized:
- Tag
id: ID for the tag in database. name: Name of the tag. frequency: posts: list of PostObjects (conditional).
- Comment
id: ID for the comment in database. content: Content of the comment. create_time: (Timestamp) create time of the comment. user: UserObject Authentication if user is login. author_mail: Author email if user is not login. author_name: Author name if user is not login. replies: List of Comment Objects.
application/json
Post API¶
-
class
fardel.apps.blog.views.
PostApi
[source]¶ URL: /api/blog/posts/
and/api/blog/posts/<post_id>/
-
get
(post_id=None)[source]¶ Optional url parameter: - post_id
Optional url query string: - page (default: 1)
- per_page (default: 16)
Response: If post_id is provided:
{ "post": PostObject(with content) }
If post_id is not provided:
{ "posts":[list of PostObjects(without content and with summarized)] "pages": Number of pages }
Errors: If post id is not valid:
status_code: 404
response: {"message":"No post with this id"}
-
Comment API¶
-
class
fardel.apps.blog.views.
CommentApi
[source]¶ URL: /api/blog/posts/<post_id>/comments/
-
get
(post_id)[source]¶ Optional url query string: - page (default: 1)
- per_page (default: 16)
Response: { "comments":[list of CommentObjects] "pages": Number of pages }
Errors: If post_id is not in valid ( not a published post or not found ):
status_code: 404 .. code-block:: python
{“message”:”No post with this id”}
-
post
(post_id)[source]¶ - Authorization token is not required but optional
Required data: - author_name (if you dont use access_token)
- author_email (if you dont use access_token)
- content
Optional data: - parent_comment_id
Response: {"message":"Comment successfuly added"}
Errors: If post_id is not in valid ( not a published post or not found ):
status_code: 404
response: {"message":"No post with this id"}
If commenter information (user_id or (author_name, author_email) ) is not provided:
status_code: 422
response: {"message":"Author name and Author email are required to post a comment or you need to sign in"}
-
Tag API¶
Category API¶
-
class
fardel.apps.blog.views.
CategoryApi
[source]¶ URL: /api/blog/categories/
or/api/blog/categories/<category_id>/posts/
-
get
(category_id=None)[source]¶ - If category_id is provided:
optional url query string: - page (default: 1)
- per_page (default: 16)
response: { "category": CategoryObject(with posts) }
errors: If category_id is not in valid:
status_code: 404 .. code-block:: python
{“message”:”No category found with this id”}
- Without category_id:
response: { "categories": [list of CategoryObject(without posts)] }
-
Products¶
Objects¶
- Category
id: ID for the category in database. name: Name of the category to display. description: children: List of Category objects.
- Product
id: ID for the product in database.
- Collection
id: ID for the collection in database.
To costumize Boghche-Server you can use the documentation below.