Skip to content

Instantly share code, notes, and snippets.

@YokiToki
Last active November 22, 2020 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YokiToki/ae7c90db32deeb69a7a1401842d69a50 to your computer and use it in GitHub Desktop.
Save YokiToki/ae7c90db32deeb69a7a1401842d69a50 to your computer and use it in GitHub Desktop.
Zakupy API Specification
# Zakupy
# Sign in into system
POST {{host}}/v1/auth/signin
Accept: application/json
Content-Type: application/json
{
"email": "email",
"password": "password"
}
###
# Logout from system
POST {{host}}/v1/auth/logout
Accept: application/json
Content-Type: application/json
{
"refreshToken": "refreshToken"
}
###
# Get all personal rosters (lists)
GET {{host}}/v1/roster
Authorization: Bearer {{authToken}}
Accept: application/json
###
# Get detailed roster (list) by uuid
GET {{host}}/v1/roster/{{param_uuid}}
Authorization: Bearer {{authToken}}
Accept: application/json
###
openapi: 3.0.0
info:
title: Zakupy API Specification
version: v0.1.0
license:
name: MIT
servers:
- url: https://zakupyapp.herokuapp.com/
paths:
/v1/auth/signin:
post:
tags:
- Auth
summary: Sign in into system
operationId: 'signIn'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SignInRequest'
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AuthCredentialsResponse'
400:
description: ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequestResponse'
500:
description: ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/ServerErrorResponse'
/v1/auth/logout:
post:
tags:
- Auth
summary: Logout from system
operationId: 'logout'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LogoutRequest'
responses:
200:
description: 'Ok'
content:
application/json:
schema:
$ref: '#/components/schemas/Response'
400:
description: ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/BadRequestResponse'
/v1/roster:
get:
tags:
- Roster
summary: Get all personal rosters (lists)
operationId: 'getRoster'
security:
- bearerAuth: []
responses:
200:
description: ok
content:
application/json:
schema:
$ref: '#/components/schemas/RosterListResponse'
500:
description: ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/ServerErrorResponse'
/v1/roster/{uuid}:
get:
tags:
- Roster
summary: Get detailed roster (list) by uuid
operationId: 'getRosterDetail'
security:
- bearerAuth: []
parameters:
- name: uuid
in: path
required: true
example: 5dfea713-d29a-4349-9e39-2b5b13584775
schema:
type: string
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/RosterResponse'
404:
description: ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/NotFoundResponse'
500:
description: ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/ServerErrorResponse'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
schemas:
SignInRequest:
description: 'Sign in request'
type: object
properties:
email:
type: string
example: user@example.org
description: Email address
password:
type: string
description: Password
required:
- email
- password
LogoutRequest:
description: 'Logout request'
type: object
properties:
refreshToken:
description: $refreshToken
type: string
Response:
description: 'Basic response'
type: object
properties:
status:
type: integer
example: 200
description: Http status code
message:
type: string
description: Response message
timestamp:
type: integer
format: int64
description: Response timestamp
success:
type: boolean
description: Response status
required:
- status
- message
- timestamp
- success
ErrorResponse:
type: object
description: 'Basic error response'
allOf:
- $ref: '#/components/schemas/Response'
- type: object
properties:
success:
description: Response status
type: boolean
default: false
example: false
ServerErrorResponse:
description: 'Server error response'
type: object
allOf:
- $ref: '#/components/schemas/ErrorResponse'
- type: object
properties:
status:
type: integer
example: 500
required:
- status
- message
- timestamp
- success
NotFoundResponse:
description: 'Not found response'
type: object
allOf:
- $ref: '#/components/schemas/ErrorResponse'
- type: object
properties:
status:
type: integer
example: 404
required:
- status
- message
- timestamp
- success
BadRequestResponse:
description: 'Bad request response'
type: object
allOf:
- $ref: '#/components/schemas/ErrorResponse'
- type: object
properties:
status:
type: integer
example: 400
required:
- status
- message
- timestamp
- success
AuthCredentialsResponse:
description: 'Auth token response'
allOf:
- $ref: '#/components/schemas/Response'
- type: object
required:
- data
properties:
data:
type: object
required:
- accessToken
- refreshToken
properties:
accessToken:
description: Access token
type: string
refreshToken:
description: Refresh token
type: string
BaseRosterResponse:
description: 'Roster list item response'
type: object
properties:
uuid:
type: string
example: 2218d427-1409-42ee-9a22-7fc94b1d4312
description: Unique ID
name:
type: string
example: Purchases
description: Shopping list name
visibility:
type: string
example: PERSONAL
enum:
- PERSONAL
- SHARED
type:
type: string
example: BASIC
enum:
- BASIC
required:
- uuid
- name
- visibility
- type
RosterItemResponse:
description: 'Roster item response'
type: object
properties:
uuid:
type: string
example: 2218d427-1409-42ee-9a22-7fc94b1d4312
description: Unique ID
name:
type: string
example: Bread
description: Shopping list item name
checked:
type: boolean
example: true
description: Is item checked
required:
- uuid
- name
- checked
DetailRosterResponse:
description: 'Detail roster response'
allOf:
- $ref: '#/components/schemas/BaseRosterResponse'
- type: object
required:
- items
properties:
items:
type: array
items:
$ref: '#/components/schemas/RosterItemResponse'
RosterListResponse:
description: 'Roster list response'
allOf:
- $ref: '#/components/schemas/Response'
- type: object
required:
- data
properties:
data:
type: array
items:
$ref: '#/components/schemas/BaseRosterResponse'
RosterResponse:
description: 'Roster response'
allOf:
- $ref: '#/components/schemas/Response'
- type: object
required:
- data
properties:
data:
$ref: '#/components/schemas/DetailRosterResponse'
parameters:
Authorization:
name: Authorization
in: header
required: true
schema:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment