Last active
July 9, 2019 11:56
-
-
Save hasuniea/0e1fa6d6e61c29ef43514711b70dd277 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| openapi: 3.0.0 | |
| info: | |
| title: CoffeeBarAPI | |
| description: | | |
| This is a RESTFul API for Coffe Bar online store. | |
| contact: | |
| name: Hasunie | |
| url: http://www.coffeebar.com | |
| email: architecture@coffeebar.com | |
| license: | |
| name: Apache 2.0 | |
| url: http://www.apache.org/licenses/LICENSE-2.0.html | |
| version: 1.0.0 | |
| x-wso2-basePath: /coffeebar/v1 | |
| x-wso2-production-endpoints: | |
| urls: | |
| - http://www.mocky.io/v2/5d1c9dcd340000a32db5ff47 | |
| paths: | |
| /order: | |
| post: | |
| description: Create a new Order | |
| x-wso2-production-endpoints: | |
| urls: | |
| - http://www.mocky.io/v2/5d1c9ed3340000a32db5ff4c | |
| requestBody: | |
| description: Order object that needs to be added | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Order' | |
| required: true | |
| responses: | |
| 201: | |
| description: Created. Successful response with the newly created object as entity in the body. Location header contains URL of newly created entity. | |
| headers: | |
| Location: | |
| description: The URL of the newly created resource. | |
| schema: | |
| type: string | |
| Content-Type: | |
| description: The content type of the body. | |
| schema: | |
| type: string | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Order' | |
| 400: | |
| description: Bad Request. Invalid request or validation error. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| 415: | |
| description: Unsupported Media Type. The entity of the request was in a | |
| not supported format. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| security: | |
| - coffeebar_auth: | |
| - write:order | |
| - read:order | |
| x-auth-type: Application & Application User | |
| x-throttling-tier: Unlimited | |
| /menu: | |
| get: | |
| description: Return a list of available menu items | |
| responses: | |
| 200: | |
| description: OK. List of APIs is returned. | |
| content: | |
| application/json: | |
| schema: | |
| type: array | |
| items: | |
| $ref: '#/components/schemas/MenuItem' | |
| 304: | |
| description: Not Modified. Empty body because the client has already the | |
| latest version of the requested resource. | |
| content: {} | |
| 406: | |
| description: Not Acceptable. The requested media type is not supported | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| security: | |
| - coffeebar_auth: | |
| - read:menu | |
| x-auth-type: Application & Application User | |
| x-throttling-tier: Unlimited | |
| post: | |
| description: add new menu | |
| requestBody: | |
| description: Menu object that needs to be added | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Menu' | |
| required: true | |
| responses: | |
| 201: | |
| description: Created. Successful response with the newly created object | |
| as entity in the body. Location header contains URL of newly created entity. | |
| headers: | |
| Location: | |
| description: The URL of the newly created resource. | |
| schema: | |
| type: string | |
| Content-Type: | |
| description: The content type of the body. | |
| schema: | |
| type: string | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Menu' | |
| 400: | |
| description: Bad Request. Invalid request or validation error. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| 415: | |
| description: Unsupported Media Type. The entity of the request was in a | |
| not supported format. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| security: | |
| - coffeebar_auth: | |
| - admin | |
| x-auth-type: Application & Application User | |
| x-throttling-tier: Unlimited | |
| /order/{orderId}: | |
| get: | |
| description: Get details of an Order | |
| parameters: | |
| - name: orderId | |
| in: path | |
| description: Order Id | |
| required: true | |
| schema: | |
| type: string | |
| format: string | |
| responses: | |
| 200: | |
| description: OK Requested Order will be returned | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Order' | |
| 304: | |
| description: Not Modified. Empty body because the client has already the | |
| latest version of the requested resource. | |
| content: {} | |
| 404: | |
| description: Not Found. Requested API does not exist. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| 406: | |
| description: Not Acceptable. The requested media type is not supported | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| security: | |
| - coffeebar_basic: [] | |
| x-auth-type: Application & Application User | |
| x-throttling-tier: Unlimited | |
| put: | |
| description: Update an existing Order | |
| parameters: | |
| - name: orderId | |
| in: path | |
| description: Order Id | |
| required: true | |
| schema: | |
| type: string | |
| format: string | |
| requestBody: | |
| description: Order object that needs to be added | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Order' | |
| required: true | |
| responses: | |
| 200: | |
| description: OK. Successful response with updated Order | |
| headers: | |
| Location: | |
| description: The URL of the newly created resource. | |
| schema: | |
| type: string | |
| Content-Type: | |
| description: The content type of the body. | |
| schema: | |
| type: string | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Order' | |
| 400: | |
| description: Bad Request. Invalid request or validation error | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| 404: | |
| description: Not Found. The resource to be updated does not exist. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| 412: | |
| description: Precondition Failed. The request has not been performed because | |
| one of the preconditions is not met. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| security: | |
| - coffeebar_auth: | |
| - write:order | |
| - read:order | |
| x-auth-type: Application & Application User | |
| x-throttling-tier: Unlimited | |
| delete: | |
| description: Delete an existing Order | |
| parameters: | |
| - name: orderId | |
| in: path | |
| description: Order Id | |
| required: true | |
| schema: | |
| type: string | |
| format: string | |
| responses: | |
| 200: | |
| description: OK. Resource successfully deleted. | |
| content: {} | |
| 404: | |
| description: Not Found. Resource to be deleted does not exist. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| 412: | |
| description: Precondition Failed. The request has not been performed because | |
| one of the preconditions is not met. | |
| content: | |
| application/json: | |
| schema: | |
| $ref: '#/components/schemas/Error' | |
| security: | |
| - pizzashack_auth: | |
| - write:order | |
| - read:order | |
| x-auth-type: Application & Application User | |
| x-throttling-tier: Unlimited | |
| components: | |
| schemas: | |
| Order: | |
| title: Pizza Order | |
| required: | |
| - orderId | |
| type: object | |
| properties: | |
| customerName: | |
| type: string | |
| delivered: | |
| type: boolean | |
| address: | |
| type: string | |
| pizzaType: | |
| type: string | |
| creditCardNumber: | |
| type: string | |
| quantity: | |
| type: number | |
| orderId: | |
| type: string | |
| ErrorListItem: | |
| title: Description of individual errors that may have occored during a request. | |
| required: | |
| - code | |
| - message | |
| type: object | |
| properties: | |
| message: | |
| type: string | |
| description: Description about individual errors occored | |
| code: | |
| type: integer | |
| format: int64 | |
| Error: | |
| title: Error object returned with 4XX HTTP status | |
| required: | |
| - code | |
| - message | |
| type: object | |
| properties: | |
| message: | |
| type: string | |
| description: Error message. | |
| error: | |
| type: array | |
| description: If there are more than one error list them out. Ex. list out | |
| validation errors by each field. | |
| items: | |
| $ref: '#/components/schemas/ErrorListItem' | |
| description: | |
| type: string | |
| description: A detail description about the error message. | |
| code: | |
| type: integer | |
| format: int64 | |
| moreInfo: | |
| type: string | |
| description: Preferably an url with more details about the error. | |
| MenuItem: | |
| title: Pizza menu Item | |
| required: | |
| - name | |
| type: object | |
| properties: | |
| price: | |
| type: string | |
| description: | |
| type: string | |
| name: | |
| type: string | |
| image: | |
| type: string | |
| securitySchemes: | |
| coffeebar_auth: | |
| type: oauth2 | |
| flows: | |
| authorizationCode: | |
| authorizationUrl: https://example.com/oauth/authorize | |
| tokenUrl: https://example.com/oauth/token | |
| scopes: | |
| read:order: modify order in your account | |
| read:menu: read your menu | |
| write:order: Grants write access | |
| admin: Grants access to admin operations | |
| coffeebar_basic: | |
| type: http | |
| scheme: basic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment