Skip to content

Instantly share code, notes, and snippets.

@achyutdev
Created March 29, 2020 18:42
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 achyutdev/5a2aac16592795e95a8f2a20c6bd0c9b to your computer and use it in GitHub Desktop.
Save achyutdev/5a2aac16592795e95a8f2a20c6bd0c9b to your computer and use it in GitHub Desktop.
Web Adaptor Service
openapi: 3.0.0
servers:
- url: 'https://pudo.com.np/web/'
info:
title: Web Adaptor Service
description: >-
Provides endpoints to integrate PUDO in web page
version: '1.0'
paths:
'/locations':
get:
description: Provides available PUDO locations either in map or list format
operationId: getLocations
security:
- apiKey: []
clientId: []
parameters:
- name: format
in: query
description: locations format
examples:
list:
value: list
maps:
value: maps
required: true
schema:
type: string
- name: location
in: query
description: current location of the user
example: "43.56447,-96.70166"
required: false
schema:
type: string
responses:
'200':
description: >-
provides list of nearby pickup/dropoff PUDO locations
content:
application/json:
schema:
$ref: '#/components/schemas/LocationResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'401':
description: 'Unauthorized, Invalid or Missing Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'403':
description: 'Access Denied, Insufficient Scope privilege Or Expired Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'412':
description: 'Precondition Failed, eTag mismatch'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'429':
description: Too Many Requests
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
default:
description: Other Errors
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'/locations/{station-id}':
get:
description: Provides location details of the requested location-id
operationId: getStationDetails
security:
- apiKey: []
clientId: []
parameters:
- name: station-id
in: path
description: Unique PUDO station id
example: "324123"
required: true
schema:
type: string
- name: location
in: query
description: User current location or the location user is searching from
example: "43.56447,-96.70166"
required: false
schema:
type: string
responses:
'200':
description: >-
provides list of nearby pickup/dropoff PUDO locations
content:
application/json:
schema:
$ref: '#/components/schemas/StationDetail'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'401':
description: 'Unauthorized, Invalid or Missing Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'403':
description: 'Access Denied, Insufficient Scope privilege Or Expired Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'429':
description: Too Many Requests
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
default:
description: Other Errors
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'/locations/{station-id}/pickups':
post:
description: 'create new pickup for the request destination'
operationId: createPickup
security:
- apiKey: []
clientId: []
parameters:
- name: station-id
in: path
description: Unique PUDO station id
example: "324123"
required: true
schema:
type: string
- name: requestId
in: header
description: unique request id
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PickupRequest'
responses:
'200':
description: Successfully created a new pickup for the provided request
content:
application/json:
schema:
$ref: '#/components/schemas/StationResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'401':
description: 'Unauthorized, Invalid or Missing Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'403':
description: 'Access Denied, Insufficient Scope privilege Or Expired Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'429':
description: Too Many Requests
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
default:
description: Other Errors
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'/locations/{station-id}/dropoffs':
post:
description: 'create new dropoff for the request destination'
operationId: createDropoff
security:
- apiKey: []
clientId: []
parameters:
- name: station-id
in: path
description: Unique PUDO station id
example: "324123"
required: true
schema:
type: string
- name: requestId
in: header
description: unique request id
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DropoffRequest'
responses:
'200':
description: Successfully created a new pickup for the provided request
content:
application/json:
schema:
$ref: '#/components/schemas/StationResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'401':
description: 'Unauthorized, Invalid or Missing Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'403':
description: 'Access Denied, Insufficient Scope privilege Or Expired Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'429':
description: Too Many Requests
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
default:
description: Other Errors
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'/locations/{station-id}/dropoffs/{request-id}':
get:
description: provides dropoff details for request id
operationId: getDropoffDetails
security:
- apiKey: []
clientId: []
parameters:
- name: station-id
in: path
description: Unique PUDO station id
example: "324123"
required: true
schema:
type: string
- name: request-id
in: path
description: unique request id
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Successfully created a new pickup for the provided request
content:
application/json:
schema:
$ref: '#/components/schemas/DropoffResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'401':
description: 'Unauthorized, Invalid or Missing Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'403':
description: 'Access Denied, Insufficient Scope privilege Or Expired Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'429':
description: Too Many Requests
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
default:
description: Other Errors
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
put:
description: 'create new dropoff for the request destination'
operationId: updateDropoff
security:
- apiKey: []
clientId: []
parameters:
- name: station-id
in: path
description: Unique PUDO station id
example: "324123"
required: true
schema:
type: string
- name: request-id
in: path
description: unique request id
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/DropoffRequest'
responses:
'200':
description: Successfully created a new pickup for the provided request
content:
application/json:
schema:
$ref: '#/components/schemas/StationResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'401':
description: 'Unauthorized, Invalid or Missing Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'403':
description: 'Access Denied, Insufficient Scope privilege Or Expired Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'429':
description: Too Many Requests
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
default:
description: Other Errors
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
delete:
description: 'delete dropoff for the request destination for specific client'
operationId: deleteDropoff
security:
- apiKey: []
clientId: []
parameters:
- name: station-id
in: path
description: Unique PUDO station id
example: "324123"
required: true
schema:
type: string
- name: request-id
in: path
description: unique request id
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Successfully created a new pickup for the provided request
content:
application/json:
schema:
$ref: '#/components/schemas/StationResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'401':
description: 'Unauthorized, Invalid or Missing Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'403':
description: 'Access Denied, Insufficient Scope privilege Or Expired Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'429':
description: Too Many Requests
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
default:
description: Other Errors
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'/locations/{station-id}/pickups/{request-id}':
get:
description: provides dropoff details for request id
operationId: getPickupDetails
security:
- apiKey: []
clientId: []
parameters:
- name: station-id
in: path
description: Unique PUDO station id
example: "324123"
required: true
schema:
type: string
- name: request-id
in: path
description: unique request id
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Successfully created a new pickup for the provided request
content:
application/json:
schema:
$ref: '#/components/schemas/DropoffResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'401':
description: 'Unauthorized, Invalid or Missing Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'403':
description: 'Access Denied, Insufficient Scope privilege Or Expired Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'429':
description: Too Many Requests
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
default:
description: Other Errors
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
put:
description: 'create new pickup for the request destination'
operationId: updatePickup
security:
- apiKey: []
clientId: []
parameters:
- name: station-id
in: path
description: Unique PUDO station id
example: "324123"
required: true
schema:
type: string
- name: request-id
in: path
description: Unique PUDO station id
example: "324123"
required: true
schema:
type: string
- name: requestId
in: header
description: unique request id
required: true
schema:
type: string
format: uuid
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PickupRequest'
responses:
'200':
description: Successfully created a new pickup for the provided request
content:
application/json:
schema:
$ref: '#/components/schemas/StationResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'401':
description: 'Unauthorized, Invalid or Missing Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'403':
description: 'Access Denied, Insufficient Scope privilege Or Expired Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'429':
description: Too Many Requests
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
default:
description: Other Errors
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
delete:
description: 'delete dropoff for the request destination for specific client'
operationId: deleteDropoff
security:
- apiKey: []
clientId: []
parameters:
- name: station-id
in: path
description: Unique PUDO station id
example: "324123"
required: true
schema:
type: string
- name: request-id
in: path
description: unique request id
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Successfully created a new pickup for the provided request
content:
application/json:
schema:
$ref: '#/components/schemas/StationResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'401':
description: 'Unauthorized, Invalid or Missing Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'403':
description: 'Access Denied, Insufficient Scope privilege Or Expired Access Token'
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'404':
description: Resource Not Found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'429':
description: Too Many Requests
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
default:
description: Other Errors
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorModel'
components:
securitySchemes:
apiKey:
type: apiKey
in: header
name: x-api-key
clientId:
type: apiKey
in: header
name: x-client-name
schemas:
ErrorModel:
type: object
properties:
developerMessage:
type: string
description: >-
Verbose, plain language description of the problem for the app
developer with hints about how to fix it.
userMessage:
type: string
description: Pass this message on to the app user if needed
errorCode:
type: string
description: Error code defined for the error
moreInfo:
type: string
description: Any additional information on the error (e.g. website links)
PickupRequest:
type: object
required:
- reason
- requestedOn
- amount
- type
properties:
reason:
type: string
requestedOn:
type: string
description: requested date and time. Format yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
amount:
description: 'Indicates the refund amount made'
type: number
type:
description: 'Type of the refund'
example: "CREDIT_MEMO"
type: string
DropoffRequest:
type: object
required:
- posTracking
- reason
- requestedOn
- amount
- type
properties:
reason:
type: string
requestedOn:
type: string
description: requested date and time. Format yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
amount:
description: 'Indicates the refund amount made'
type: number
type:
description: 'Type of the refund'
example: "CREDIT_MEMO"
type: string
StationResponse:
type: object
required:
- enteredBy
properties:
enteredBy:
type: string
DropoffResponse:
type: object
required:
- reason
- requestedOn
- amount
- type
properties:
reason:
type: string
requestedOn:
type: string
description: requested date and time. Format yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
amount:
description: 'Indicates the refund amount made'
type: number
type:
description: 'Type of the refund'
example: "CREDIT_MEMO"
type: string
LocationResponse:
type: object
properties:
stations:
type: array
items:
$ref: '#/components/schemas/StationDetail'
location-map:
$ref: '#/components/schemas/LocationMap'
StationDetail:
type: object
properties:
id:
type: string
address:
type: string
distanceFrom:
type: string
estimatedPrice:
type: string
LocationMap:
type: object
properties:
name:
type: string
href:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment