Skip to content

Instantly share code, notes, and snippets.

@Streppel
Created May 26, 2021 02:30
Show Gist options
  • Save Streppel/23641cf2484b6855ec55ad0f91b1f22f to your computer and use it in GitHub Desktop.
Save Streppel/23641cf2484b6855ec55ad0f91b1f22f to your computer and use it in GitHub Desktop.
openapi: "3.0.0"
info:
version: 1.0.0
title: SimplySend Procurement API
license:
name: MANNING
servers:
- url: http://simplyspend.apisecurity.liveproject.manning.com/v1
paths:
/users:
get:
summary: List all Users
operationId: listUsers
tags:
- users
parameters:
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
type: integer
format: int32
responses:
'200':
description: A paged array of users
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: "#/components/schemas/Users"
'401':
$ref: '#/components/responses/UnauthorizedError'
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: create a User
operationId: createUser
tags:
- users
requestBody:
description: Send the User Object
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/User'
responses:
'201':
description: Null response
'401':
$ref: '#/components/responses/UnauthorizedError'
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/users/{userId}:
get:
summary: Info for a specific user
operationId: showUserById
tags:
- users
parameters:
- name: userId
in: path
required: true
description: The id of the user to retrieve
schema:
type: string
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/User"
'401':
$ref: '#/components/responses/UnauthorizedError'
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/orders:
get:
summary: List all orders
operationId: listOrders
tags:
- orders
parameters:
- name: status
in: query
description: status of the order REQUESTED,APPROVED,DENIED
required: false
schema:
type: string
enum: [REQUESTED,APPROVED,DENIED]
- name: reportee
in: query
description: if true returns orders of reportees by name for approval
required: false
schema:
type: string
description: retrieve reportee order requests by emailId
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
type: integer
format: int32
responses:
'200':
description: A paged array of orders
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: "#/components/schemas/Orders"
'401':
$ref: '#/components/responses/UnauthorizedError'
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: Request a order
operationId: requestOrder
tags:
- orders
requestBody:
description: Send the Order Object
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
responses:
'201':
description: Null response
'401':
$ref: '#/components/responses/UnauthorizedError'
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/orders/{orderId}:
get:
summary: Info for a specific order
operationId: showOrderById
tags:
- orders
parameters:
- name: orderId
in: path
required: true
description: The id of the order to retrieve
schema:
type: string
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Order"
'401':
$ref: '#/components/responses/UnauthorizedError'
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/orders/{orderId}/approve:
post:
summary: Approve a order
operationId: approveOrders
tags:
- orders
parameters:
- name: orderId
in: path
required: true
description: The id of the order to retrieve
schema:
type: string
responses:
'201':
description: Approval response
content:
text/plain:
schema:
type: boolean
example: true for approved or false for deny of order
'401':
$ref: '#/components/responses/UnauthorizedError'
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/items:
get:
summary: List all items available for purchase
operationId: listItems
tags:
- items
parameters:
- name: type
in: query
description: type of the item HARDWARE,SOFTWARE,STATIONARY,TRAINING,MISC
required: false
schema:
type: string
enum: [HARDWARE,SOFTWARE,STATIONARY,TRAINING,MISC]
- name: limit
in: query
description: How many items to return at one time (max 100)
required: false
schema:
type: integer
format: int32
responses:
'200':
description: A paged array of orders
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: "#/components/schemas/Orders"
'401':
$ref: '#/components/responses/UnauthorizedError'
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
summary: create an item (used by admin)
operationId: createItem
tags:
- items
requestBody:
description: Send the Item Object
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Item'
responses:
'201':
description: Null response
'401':
$ref: '#/components/responses/UnauthorizedError'
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/items/{itemId}:
get:
summary: Info for a specific item
operationId: getItemById
tags:
- items
parameters:
- name: itemId
in: path
required: true
description: The id of the item to retrieve
schema:
type: string
responses:
'200':
description: Expected response to a valid request
content:
application/json:
schema:
$ref: "#/components/schemas/Item"
'401':
$ref: '#/components/responses/UnauthorizedError'
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/login:
post:
summary: Login User
operationId: login
tags:
- users
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
emailId: # <!--- form field name
type: string
password: # <!--- form field name
type: string
required:
- emailId
- password
responses:
'200':
description: Login response
content:
text/plain:
schema:
type: boolean
example: true for User Login success.
'401':
$ref: '#/components/responses/UnauthorizedError'
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
securitySchemes:
basicAuth: # <-- arbitrary name for the security scheme
type: http
scheme: basic
responses:
UnauthorizedError:
description: Authentication information is missing or invalid
headers:
WWW_Authenticate:
schema:
type: string
schemas:
User:
type: object
required:
- name
- phone
properties:
id:
type: integer
format: int64
firstName:
type: string
lastName:
type: string
emailId:
type: string
age:
type: integer
format: int64
phone:
type: string
role:
type: string
description: Manager or Reportee role
enum: [MGR,REPORTEE,ADMIN]
password:
type: string
managerName:
type: string
description: Name of the Manager to whom current User reports to
address:
type: string
tag:
type: string
Order:
type: object
required:
- id
- name
properties:
id:
type: integer
format: int64
items:
type: array
items:
$ref: '#/components/schemas/Item'
status:
type: string
enum: [REQUESTED,APPROVED,DENIED]
reason:
type: string
comment:
type: string
description: Approver Comments
Item:
type: object
required:
- id
- name
- price
properties:
id:
type: integer
format: int64
type:
type: string
enum: [HARDWARE,SOFTWARE,STATIONARY,TRAINING,MISC]
name:
type: string
price:
type: integer
description: price of the item in any currency
description:
type: string
description: Description of the Item
Orders:
type: array
items:
$ref: "#/components/schemas/Order"
Items:
type: array
items:
$ref: "#/components/schemas/Item"
Users:
type: array
items:
$ref: "#/components/schemas/User"
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
security:
- basicAuth: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment