openapi: 3.0.0 info: title: All my rest api description: Rest API for experiment. version: 0.1.1 servers: - url: http://localhost/rest-php/binhusenstore description: Binhusenstore end point tags: - name: order description: order of products paths: /order: post: tags: - order summary: Lets a user post a new order requestBody: $ref: "#/components/requestBodies/order" responses: "201": description: Successfully created a new order content: application/json: schema: $ref: "#/components/schemas/Return_after_post" "400": $ref: "#/components/responses/400Error" "401": $ref: "#/components/responses/401Error" /orders: parameters: - name: limit in: query required: true description: Limit of orders schema: type: string example: O220203902 get: tags: - order summary: Get all orders. responses: "200": $ref: "#/components/responses/getorder200" "401": $ref: "#/components/responses/401Error" "404": description: order not found /order/{id}: parameters: - name: id in: path required: true description: The ID of the order schema: type: string example: "WAR220203902" get: tags: - order summary: Get order by id_order or get order by id_group_order. responses: "200": description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: false data: type: object properties: id: type: string example: "WAR22500001" date_order: type: string example: "2023-07-23" id_group: type: string is_group: type: boolean id_product: type: string name_of_customer: type: string sent: type: string title: type: string titles_group: type: array items: default: string total_balance: type: number example: 2000000 admin_charge: type: number example: 10000 "404": $ref: "#/components/responses/404Error" "401": $ref: "#/components/responses/401Error" put: tags: - order summary: Update order by id requestBody: $ref: "#/components/requestBodies/order" responses: "201": $ref: "#/components/responses/200Success" "400": $ref: "#/components/responses/400Error" "401": $ref: "#/components/responses/401Error" "404": $ref: "#/components/responses/404Error" delete: tags: - order summary: Delete order by id responses: "201": $ref: "#/components/responses/200Success" "400": $ref: "#/components/responses/400Error" "401": $ref: "#/components/responses/401Error" "404": $ref: "#/components/responses/404Error" /order/count: get: tags: - order summary: Count total order. responses: "200": description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: true data: type: number example: 10 "401": $ref: "#/components/responses/401Error" "404": description: order not found /order/move_to_archive: post: tags: - order requestBody: required: true content: application/json: schema: type: object properties: id_order: type: string example: G234567 phone: type: string example: 1238099712309 summary: Move the order to archived. responses: "201": description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: true message: type: string example: Order archived "401": $ref: "#/components/responses/401Error" "404": description: order not found /order/phone/{id}: parameters: - name: id_order in: query required: true description: The order Id schema: type: string example: O220203902 get: tags: - order summary: Get phone by order id. responses: "200": description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: true data: type: string example: 628123456789 "401": $ref: "#/components/responses/401Error" "404": description: order not found /order/cancel: post: requestBody: required: true content: application/json: schema: type: object properties: id_order: type: string example: "O23041230" phone: type: string example: 1561234123 tags: - order summary: Is the phone number is matched with db to cancel order. responses: "200": description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: true message: type: boolean example: true "401": $ref: "#/components/responses/401Error" "404": description: order not found content: application/json: schema: type: object properties: success: type: boolean default: false message: type: boolean example: false /orders/merge/add_id_group: put: requestBody: required: true content: application/json: schema: type: object properties: id_order_1: type: string example: "O23041230" id_order_2: type: string example: "O23041231" tags: - order summary: Create Id group for 2 orders (phone_order must same). responses: "200": description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: true message: type: boolean example: "Order grouped" "401": $ref: "#/components/responses/401Error" "400": description: order not found content: application/json: schema: type: object properties: success: type: boolean default: false message: type: string "404": description: order not found content: application/json: schema: type: object properties: success: type: boolean default: false message: type: boolean example: false /orders/merge/remove_id_group: put: requestBody: required: true content: application/json: schema: type: object properties: id_group: type: string example: "O23041230" phone: type: string example: "6128376123" tags: - order summary: Remove Id group for orders and payment (phone_order must same). responses: "200": description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: true message: type: boolean example: "Order unmerged" "401": $ref: "#/components/responses/401Error" "400": description: order not found content: application/json: schema: type: object properties: success: type: boolean default: false message: type: string "404": description: order not found content: application/json: schema: type: object properties: success: type: boolean default: false message: type: boolean example: false /order/dashboard/{id}: parameters: - name: id in: path required: true description: The ID of the order schema: type: string example: "WAR220203902" get: tags: - order summary: Get order dashboard by id_order. responses: "200": description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: false data: type: object properties: day_percent: type: number example: 30 day_remaining: type: number example: 120 total_balance_percent: type: number example: 20 total_payments_count: type: number example: 30 date_order: type: string example: "2023-07-23" name_of_customer: type: string title: type: string total_balance: type: number example: 2000000 admin_charge: type: number example: 10000 total_paid: type: number example: 2000 payments: type: array items: type: object properties: id: type: string order_number: type: number date_paid: type: string example: "2023-07-23" balance: type: number "404": $ref: "#/components/responses/404Error" "401": $ref: "#/components/responses/401Error" # End of order end point components: schemas: Return_after_post: type: object properties: success: type: boolean example: true id: type: string example: "WAR22500001" order: type: object properties: id: type: string example: "WAR22500001" date_order: type: string example: "2023-07-23" id_group: type: string is_group: type: boolean id_product: type: string name_of_customer: type: string sent: type: string title: type: string total_balance: type: number example: 2000000 admin_charge: type: number example: 10000 responses: 400Error: description: Invalid request content: application/json: schema: type: object properties: success: type: boolean default: false message: type: string 401Error: description: Invalid Authorization Or Unauthorization content: application/json: schema: type: object properties: success: type: boolean default: false message: type: string default: "You must be authenticated to access this resource." 200Success: description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: true message: type: string default: Update source success 404Error: description: Source not found content: application/json: schema: type: object properties: success: type: boolean default: false message: type: string default: Source not found getorder200: description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: true data: type: array items: $ref: "#/components/schemas/order" requestBodies: order: required: true content: application/json: schema: type: object properties: date_order: type: string example: "2023-07-23" id_group: type: string is_group: type: boolean id_product: type: string name_of_customer: type: string sent: type: string title: type: string total_balance: type: number phone: type: number admin_charge: type: boolean start_date_payment: type: string balance_per_period: type: number week_distance: type: number