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: testimony description: testimony of products paths: /testimony: post: tags: - testimony summary: Lets a user post a new testimony requestBody: $ref: "#/components/requestBodies/testimony" responses: "201": description: Successfully created a new testimony content: application/json: schema: $ref: "#/components/schemas/Return_after_post" "400": $ref: "#/components/responses/400Error" "401": $ref: "#/components/responses/401Error" /testimonies: parameters: - name: id_product in: query required: false description: The ID of the product schema: type: string example: "P220203902" get: tags: - testimony summary: Get all testimonies. responses: "200": $ref: "#/components/responses/getTestimony200" "401": $ref: "#/components/responses/401Error" "404": description: testimony not found /testimonies/landing_page: get: tags: - testimony summary: Get testimony for landing page. responses: "200": description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: true data: type: array items: type: object properties: id: type: string example: "WAR22500001" diplay_name: type: string example: rijalbinhusen rating: type: number example: 5 content: type: string example: "QWERTYASDW" product_name: type: string example: rijalbinhusen product product_image: type: string example: rijalbinhusen.rijalbinhusen/image/iss.jpg "401": $ref: "#/components/responses/401Error" "404": description: testimony not found /testimony/{id}: parameters: - name: id in: path required: true description: The ID of the testimony schema: type: string example: "WAR220203902" get: tags: - testimony summary: Get testimony by id. responses: "200": $ref: "#/components/responses/getTestimony200" "404": $ref: "#/components/responses/404Error" "401": $ref: "#/components/responses/401Error" put: tags: - testimony summary: Update testimony by id requestBody: required: true content: application/json: schema: type: object properties: rating: type: number example: 5 content: type: string example: "QWERTYASDW" responses: "201": $ref: "#/components/responses/200Success" "400": $ref: "#/components/responses/400Error" "401": $ref: "#/components/responses/401Error" "404": $ref: "#/components/responses/404Error" delete: tags: - testimony summary: Delete testimony by id responses: "201": $ref: "#/components/responses/200Success" "400": $ref: "#/components/responses/400Error" "401": $ref: "#/components/responses/401Error" "404": $ref: "#/components/responses/404Error" # End of testimony end point components: schemas: Return_after_post: type: object properties: success: type: boolean example: true id: type: string example: "WAR22500001" testimony: type: object properties: id: type: string example: "WAR22500001" id_user: type: string example: "QWERTYASDW" diplay_name: type: string example: rijalbinhusen id_product: type: string example: "QWERTYASDW" rating: type: number example: 5 content: type: string example: "QWERTYASDW" 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 getTestimony200: description: Success operation content: application/json: schema: type: object properties: success: type: boolean default: true data: type: array items: type: object properties: id: type: string example: "WAR22500001" diplay_name: type: string example: rijalbinhusen id_product: type: string example: "QWERTYASDW" rating: type: number example: 5 content: type: string example: "QWERTYASDW" requestBodies: testimony: required: true content: application/json: schema: type: object properties: id_user: type: string example: "QWERTYASDW" diplay_name: type: string example: rijalbinhusen id_product: type: string example: "QWERTYASDW" rating: type: number example: 5 content: type: string example: "QWERTYASDW"