Skip to content

Instantly share code, notes, and snippets.

@kunbud1989
Created July 6, 2020 06:10
Show Gist options
  • Save kunbud1989/54291f5cbe9b33e7b1951247d3600d0b to your computer and use it in GitHub Desktop.
Save kunbud1989/54291f5cbe9b33e7b1951247d3600d0b to your computer and use it in GitHub Desktop.
Jamban Cleaner API
openapi: 3.0.0
info:
title: Jam8and Cleaner API
version: '1.0'
description: |-
![Jamban.id](https://i.imgur.com/Jy4Hri7.png)
![Python](https://img.shields.io/badge/Python-v3.7-3776AB.svg?style=flat-square&logo=python) ![Flask](https://img.shields.io/badge/Flask-v1.1.2-000000.svg?style=flat-square&logo=flask) ![MySQL](https://img.shields.io/badge/MySQL-v5.7.30-4479A1.svg?style=flat-square&logo=mysql) ![MongoDB](https://img.shields.io/badge/MongoDB-v4.2.8-47A248.svg?style=flat-square&logo=mongodb) ![Redis](https://img.shields.io/badge/Redis-v3.0.7-DC382D.svg?style=flat-square&logo=redis) ![Json Web Tokens](https://img.shields.io/badge/JSON_Web_Tokens-v1.0.1-000000.svg?style=flat-square&logo=json)
# Jamban Cleaner API
All list API for Project Jam8and
contact:
name: Ariyanki
url: 'https://github.com/ariyanki'
email: ariyanki.bahtiar@gmail.com
license:
name: MIT
servers:
- url: 'http://localhost:8899'
description: Local
paths:
/api/v1/user/login:
post:
summary: User Login
operationId: post-api-v1-user-login
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Success:
value:
data:
access_token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTQwODc1MTEsImlhdCI6MTU5NDAwMTExMSwibmJmIjoxNTk0MDAxMTExLCJqdGkiOiI2YTIzNWUyZC03ZjBlLTQ4MDQtODZmZi1kNWUxNWJlMWY1ZjYiLCJpZGVudGl0eSI6ImFkbWluIiwiZnJlc2giOmZhbHNlLCJ0eXBlIjoiYWNjZXNzIiwidXNlcl9jbGFpbXMiOnsidXNlcm5hbWUiOiJhZG1pbiIsInVpZCI6MX19.0tsCkyBDeWH9BP9GQ_ECivt9aH9W_fnJ-iBvTIHU9Po
refresh_token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTY1OTMxMTEsImlhdCI6MTU5NDAwMTExMSwibmJmIjoxNTk0MDAxMTExLCJqdGkiOiI5ODcyY2FiNC0zNjBjLTQ2OTUtYTU4ZC1mNGFkYjcyYjBhOTUiLCJpZGVudGl0eSI6ImFkbWluIiwidHlwZSI6InJlZnJlc2gifQ.IY3L5kZmtK5M0b5MdURx6ax8burXaJjXAqF-_YPjqiM
message:
body: Success
title: Info
'422':
description: Unprocessable Entity (WebDAV)
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Login Failed:
value:
data: null
message:
body: 'Login Failed, check your username & password'
title: Error
'500':
description: Internal Server Error
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Error:
value:
data:
traces:
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask/app.py\", line 1950, in full_dispatch_request\n rv = self.dispatch_request()\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask/app.py\", line 1936, in dispatch_request\n return self.view_functions[rule.endpoint](**req.view_args)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask_restful/__init__.py\", line 477, in wrapper\n resp = resource(*args, **kwargs)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask/views.py\", line 89, in view\n return self.dispatch_request(*args, **kwargs)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask_restful/__init__.py\", line 587, in dispatch_request\n resp = meth(*args, **kwargs)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/app/apis/user.py\", line 37, in post\n 'password': {'type': 'string', 'required': True, 'empty': False}\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/app/libraries/validator.py\", line 89, in wrp_validate\n self.normalized(document, schema)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/cerberus/validator.py\", line 525, in normalized\n self.__init_processing(document, schema)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/cerberus/validator.py\", line 501, in __init_processing\n raise DocumentError(errors.DOCUMENT_MISSING)\n"
type: DocumentError
message:
body: Internal Server Error
title: Error
parameters: []
tags:
- User
requestBody:
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Login:
value:
username: admin
password: '123456'
description: User Login
/api/v1/user/profile:
get:
summary: User Profile
tags:
- User
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Success:
value:
data:
balance:
- cash_balance: 100000
payment_method_id: 1
payment_method_name: Coin
point_balance: 0
- cash_balance: 250000
payment_method_id: 2
payment_method_name: OVO
point_balance: 50000
birthdate: null
email: admin@admin.com
fullname: Administrator
gender: null
phonenumber: '0700000000000'
photo_filename: 'http://127.0.0.1:8899/static/assets/images/profile/None'
username: admin
message:
body: Success
title: Info
'401':
description: Unauthorized
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Autorized:
value:
msg: Missing Authorization Header
operationId: get-api-v1-user-profile
parameters: []
security:
- bearerAuth: []
description: User Profile
/api/v1/user/register:
post:
summary: User Register
operationId: post-api-v1-user-register
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Success:
value:
data:
access_token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTQwOTY3NjgsImlhdCI6MTU5NDAxMDM2OCwibmJmIjoxNTk0MDEwMzY4LCJqdGkiOiJmYzI5ZGIyNi1hNjFmLTQzMTYtYWIwYy1lMTViMGFiMWRmNmYiLCJpZGVudGl0eSI6ImFkbWluMiIsImZyZXNoIjpmYWxzZSwidHlwZSI6ImFjY2VzcyIsInVzZXJfY2xhaW1zIjp7InVzZXJuYW1lIjoiYWRtaW4yIiwidWlkIjozfX0.d_MRU-EG5iBPr7nuvhKXH_-Hvb9NAcVwKnXOa5ZFnXQ
refresh_token: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTY2MDIzNjgsImlhdCI6MTU5NDAxMDM2OCwibmJmIjoxNTk0MDEwMzY4LCJqdGkiOiJjNWU0M2IzMS0zNTA5LTRjODAtODI2OC1lMmZhNWI3NWRhZjQiLCJpZGVudGl0eSI6ImFkbWluMiIsInR5cGUiOiJyZWZyZXNoIn0.xGir8qiYrgN02csbxw6UHG7HejyBMzgUzxJpPAh0PcA
message:
body: Success
title: Info
'422':
description: Unprocessable Entity (WebDAV)
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Exists:
value:
data: null
message:
body:
- "username : 'admin' value is already exists, please use another value"
title: Error
tags:
- User
description: User Register
requestBody:
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Success:
value:
username: username
password: password
Example Exists:
value:
username: admin
password: '123456'
/api/v1/payment_method/list:
get:
summary: Payment Method List
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Success:
value:
data:
- balance:
cash_balance: 250000
point_balance: 50000
description: Ovo Payment Method
icon: 'https://rec-data.kalibrr.com/logos/DRFRTXRJM9AB2UGGBCEDGNLAT2C59X9QAXFYKRGQ-5c879cf3.png'
id: 2
payment_instruction: null
payment_method_name: OVO
message:
body: Success
title: Info
'401':
description: Unauthorized
content:
application/json:
schema:
type: object
properties: {}
examples:
example:
value:
msg: Missing Authorization Header
operationId: get-api-v1-payment_method-list
tags:
- Application
description: Payment Method List
security:
- bearerAuth: []
/api/v1/transaction/process:
post:
summary: Submit Transaction
operationId: post-api-v1-transaction-process
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties: {}
'401':
description: Unauthorized
content:
application/json:
schema:
type: object
properties: {}
examples:
example:
value:
msg: Missing Authorization Header
'422':
description: Unprocessable Entity (WebDAV)
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Not Enough Balance:
value:
data: null
message:
body: Not Enough Balance
title: Failed
description: Submit Transaction
requestBody:
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Input:
value:
facility_id: 1
description: ''
tags:
- Transaction
security:
- bearerAuth: []
/api/v1/rating/:
get:
summary: Rating
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Success:
value:
data:
emoticon:
- emoticon_name: Very Bad
id: 1
- emoticon_name: Bad
id: 2
- emoticon_name: Medium
id: 3
- emoticon_name: Good
id: 4
- emoticon_name: Very Good
id: 5
experience:
- experience_name: Cleanliness
id: 1
- experience_name: Aromatic
id: 2
- experience_name: Location
id: 3
- experience_name: Toilet Condition
id: 4
- experience_name: Others
id: 5
message:
body: Success
title: Info
'401':
description: Unauthorized
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Authorized:
value:
msg: Missing Authorization Header
operationId: get-api-v1-rating
tags:
- Application
security:
- bearerAuth: []
post:
summary: Submit Rating
operationId: post-api-v1-rating
responses:
'200':
description: OK
'401':
description: Unauthorized
content:
application/json:
schema:
type: object
properties: {}
examples:
example:
value:
msg: Missing Authorization Header
'422':
description: Unprocessable Entity (WebDAV)
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Error:
value:
data: null
message:
body:
- 'transaction_id : required field'
title: Error
tags:
- Application
security:
- bearerAuth: []
requestBody:
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Body:
value:
emoticon_id: 1
experience_id: 1
facility_id: 1
description: Submit Rating
/api/v1/transaction/list:
post:
summary: Transaction List
operationId: post-api-v1-transaction-list
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Success:
value:
data:
data:
- created_at: '2020-07-06T11:43:21.386158'
created_by: 1
facility_address: Jalan A
facility_id: 1
facility_name: Facility A
facility_price: 2000
id: 1
passcode: null
payment_method_id: 1
payment_method_name: Coin
rating:
comment: null
emoticon_id: '1'
emoticon_name: Very Bad
experience_id: '1'
experience_name: Cleanliness
facility_id: 1
facility_name: Facility A
status: 3
status_name: Paid
updated_at: '2020-07-06T11:43:21.441492'
updated_by: null
next: 1
prev: 1
message:
body: Success
title: Info
'401':
description: Unauthorized
content:
application/json:
schema:
type: object
properties: {}
examples:
example:
value:
msg: Missing Authorization Header
security:
- bearerAuth: []
description: Transaction List
tags:
- Transaction
'/api/v1/transaction/{id}':
get:
summary: Transaction Details
tags:
- Transaction
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Success:
value:
data:
created_at: '2020-07-06T11:43:21.386158'
created_by: 1
facility_address: Jalan A
facility_id: 1
facility_name: Facility A
facility_price: 2000
id: 1
passcode: null
payment_method_id: 1
payment_method_name: Coin
rating:
comment: null
emoticon_id: '1'
emoticon_name: Very Bad
experience_id: '1'
experience_name: Cleanliness
facility_id: 1
facility_name: Facility A
status: 3
status_name: Paid
updated_at: '2020-07-06T11:43:21.441492'
updated_by: null
message:
body: Success
title: Info
'401':
description: Unauthorized
content:
application/json:
schema:
type: object
properties: {}
examples:
example:
value:
msg: Missing Authorization Header
operationId: get-api-v1-transaction-1
description: Transaction Details
security:
- bearerAuth: []
parameters:
- schema:
type: string
name: id
in: path
required: true
'/api/v1/facility/lock/status/{id}':
get:
summary: Facility Lock
responses:
'200':
description: OK
'401':
description: Unauthorized
content:
application/json:
schema:
type: object
properties: {}
examples:
example:
value:
msg: Missing Authorization Header
'500':
description: Internal Server Error
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Error:
value:
data:
traces:
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask/app.py\", line 1950, in full_dispatch_request\n rv = self.dispatch_request()\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask/app.py\", line 1926, in dispatch_request\n self.raise_routing_exception(req)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask/app.py\", line 1908, in raise_routing_exception\n raise request.routing_exception\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask/ctx.py\", line 350, in match_request\n result = self.url_adapter.match(return_rule=True)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/werkzeug/routing.py\", line 1799, in match\n raise NotFound()\n"
type: NotFound
message:
body: Internal Server Error
title: Error
operationId: get-api-v1-facility-lock-status-1
tags:
- Application
description: |-
Facility Lock
**id**: integer
security:
- bearerAuth: []
parameters:
- schema:
type: string
name: id
in: path
required: true
/api/v1/transaction_coin/process:
post:
summary: Transaction Coin
operationId: post-api-v1-transaction_coin-process
responses:
'200':
description: OK
'401':
description: Unauthorized
content:
application/json:
schema:
type: object
properties: {}
examples:
example:
value:
msg: Missing Authorization Header
'500':
description: Internal Server Error
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Error:
value:
data:
traces:
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask/app.py\", line 1950, in full_dispatch_request\n rv = self.dispatch_request()\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask/app.py\", line 1936, in dispatch_request\n return self.view_functions[rule.endpoint](**req.view_args)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask_restful/__init__.py\", line 477, in wrapper\n resp = resource(*args, **kwargs)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask/views.py\", line 89, in view\n return self.dispatch_request(*args, **kwargs)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask_restful/__init__.py\", line 587, in dispatch_request\n resp = meth(*args, **kwargs)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/.env/lib/python3.7/site-packages/flask_jwt_extended/view_decorators.py\", line 40, in wrapper\n return fn(*args, **kwargs)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/app/libraries/util.py\", line 47, in wrapper\n return function(*args, **kwargs)\n"
- " File \"/Users/kun.budiharta/Documents/FREELANCE/jamban-cleaner-api/app/apis/transaction_coin.py\", line 61, in post\n return self.response(VariableConstant.TRANSACTION_ADD_FAILED)\n"
type: AttributeError
message:
body: Internal Server Error
title: Error
security:
- bearerAuth: []
requestBody:
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Input:
value:
coin_price_id: 1
payment_method_id: 3
description: Transaction Coin
tags:
- Transaction
/api/v1/coin_price/list:
get:
summary: Coin Price List
tags:
- Application
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Success:
value:
data: []
message:
body: Success
title: Info
'401':
description: ''
content:
application/json:
schema:
$ref: '#/components/schemas/Missing-Authorization-Header'
examples:
example:
value:
msg: Missing Authorization Header
'422':
description: Unprocessable Entity (WebDAV)
content:
application/json:
schema:
type: object
properties: {}
examples:
example:
value:
msg: "Bad Authorization header. Expected value 'Bearer <JWT>'"
operationId: get-api-v1-coin_price-list
description: Coin Price List
security:
- bearerAuth: []
/api/v1/mst_item/list:
get:
summary: Master Items
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties: {}
examples:
Example Success:
value:
data:
- icon: ''
id: 1
is_show_at_detail_page: 1
item_name: Urinoir
- icon: ''
id: 2
is_show_at_detail_page: 1
item_name: Toilet
message:
body: Success
title: Info
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/Missing-Authorization-Header'
examples:
Example:
value:
msg: Missing Authorization Header
'422':
description: Unprocessable Entity (WebDAV)
content:
application/json:
schema:
type: object
properties: {}
examples:
Example:
value:
msg: "Bad Authorization header. Expected value 'Bearer <JWT>'"
operationId: get-api-v1-mst_item-list
tags:
- Application
security:
- bearerAuth: []
description: Master Items
components:
schemas:
Bad-Authorization-header:
title: Bad Authorization Header
type: object
x-examples:
Bad Authorization Header:
msg: "Bad Authorization header. Expected value 'Bearer <JWT>'"
properties:
msg:
type: string
description: Bad Authorization header
Missing-Authorization-Header:
title: Missing Authorization Header
type: object
x-examples:
Missing Authorization Header:
msg: Missing Authorization Header
properties:
msg:
type: string
description: Missing Authorization Header
securitySchemes:
bearerAuth:
type: http
scheme: bearer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment