Files
old-svijetlastrana/docs/swagger/nemt-portal-api.yaml
2018-04-25 13:16:36 +02:00

1211 lines
33 KiB
YAML

swagger: "2.0"
info:
version: "1.0.2"
title: NEMT Member API
description: |
RESTful API for NEMT Member App
Repo: <a href="http://bitbucket.org/nemt/nemt-portal-api">nemt-portal-api</a>
Use the lockpad icon on the right side of a route to authorize the route.
contact:
name: Carlos Andrioli
email: carlos@brighterdevelopment.com
basePath: /v1
schemes:
- http
consumes:
- application/json
produces:
- application/json
securityDefinitions:
AppKey:
type: apiKey
in: header
name: App
description: Application Key (use "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx") only used to authenticate the application
AppToken:
type: apiKey
in: header
name: Token
description: The App Bearer token. Need to make a get request to the address "/v1/authenticate" with the "App" header and the log in body
tags:
- name: auth
description: Endpoints for system and users authentication.
- name: member
description: Endpoints for members of a participating payer.
- name: visits
description: Endpoints for visits to participating providers by members of a participating payer.
- name: notifications
description: Endpoints for notifications related to members, visits, providers and system state.
- name: rides
description: Endpoints for rides to participating providers for members of participating payers.
- name: providers
description: Endpoints for participating providers related to a member of a participating payer
- name: messages
description: Endpoints for (tbd) message types.
paths:
/authenticate/:
post:
tags:
- auth
summary: Authorize the application use
description: Authorizes the application routes returning a JWT token for authentication
operationId: authenticateApp
security:
- AppKey: []
parameters:
- name: data
in: body
description: Member authentication data
required: true
schema:
$ref: '#/definitions/AuthRequest'
responses:
200:
description: Get the token for application authorization
schema:
$ref: '#/definitions/AuthResponse'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/visits/:
get:
tags:
- visits
- member
summary: Get a filtered list of member-visits to participating providers
description: Get a list of visits
operationId: listVisits
security:
- AppToken: []
parameters:
- name: page
in: query
description: Pagination page number
default: 1
required: false
type: integer
format: int64
- name: quantity
in: query
description: Pagination quantity per page
default: 10
type: integer
format: int64
responses:
200:
description: Visits paginated list
schema:
$ref: '#/definitions/VisitsPaginatedResponse'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
post:
tags:
- visits
- member
summary: Create a visit to a participating provider for an eligible member.
description: Reserves a pre-defined or arbitrary visit time range
operationId: addVisit
security:
- AppToken: []
parameters:
- name: data
in: body
description: Visit data
required: true
schema:
$ref: '#/definitions/Visit'
responses:
200:
description: Visit object with all the ID and remanescent parameters filled
schema:
$ref: '#/definitions/Visit'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/visits/{visit_uuid}/:
get:
tags:
- visits
- member
summary: Get details of a single member-visit to a participating provider.
description: Get details of a single member-provider visit
operationId: getVisitDetail
security:
- AppToken: []
parameters:
- name: visit_uuid
in: path
description: Visit unique identifier
type: string
required: true
responses:
200:
description: Visit Details
schema:
$ref: '#/definitions/Visit'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
put:
tags:
- visits
- member
summary: Update a single member-visit to a participating provider.
description: Get the member visit
operationId: updatemember
security:
- AppToken: []
parameters:
- name: visit_uuid
in: path
description: Visit unique identifier
type: string
required: true
- name: data
in: body
description: Visit data
required: true
schema:
$ref: '#/definitions/Visit'
responses:
200:
description: Visit detail
schema:
$ref: '#/definitions/Visit'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
delete:
tags:
- visits
- member
summary: Delete a single member-visit to a participating provider.
description: Cancel a member appointment
operationId: deletemember
security:
- AppToken: []
parameters:
- name: visit_uuid
in: path
description: Visit unique identifier
type: string
required: true
responses:
204:
description: No return if everything works
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/members/:
get:
tags:
- member
summary: Get a filtered list of members
description: Get a list of members
operationId: listmembers
security:
- AppToken: []
parameters:
- name: page
in: query
description: Pagination page number
default: 1
required: false
type: integer
format: int64
- name: quantity
in: query
description: Pagination quantity per page
default: 10
type: integer
format: int64
responses:
200:
description: members paginated list
schema:
$ref: '#/definitions/MembersPaginatedResponse'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/members/{member_uuid}/:
get:
tags:
- member
summary: member detail
description: Get a member's detail data
operationId: getmemberDetail
security:
- AppToken: []
parameters:
- name: member_uuid
in: path
description: member unique identifier
type: string
required: true
responses:
200:
description: member detail
schema:
$ref: '#/definitions/Member'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/notifications/:
get:
tags:
- notifications
- member
summary: Get a list of notifications for a single member.
description: Get a list of notifications for a single member.
operationId: listNotifications
security:
- AppToken: []
parameters:
- name: page
in: query
description: Pagination page number
default: 1
required: false
type: integer
format: int64
- name: quantity
in: query
description: Pagination quantity per page
default: 10
type: integer
format: int64
responses:
200:
description: Notification paginated list
schema:
$ref: '#/definitions/NotificationPaginatedResponse'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/notifications/{notification_uuid}/:
get:
tags:
- notifications
- member
summary: Get the member's notification
description: Get a specific notification
operationId: getNotification
security:
- AppToken: []
parameters:
- name: notification_uuid
in: path
description: Notification unique identifier
type: string
required: true
responses:
200:
description: Notification detail
schema:
$ref: '#/definitions/Notification'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/rides/:
get:
tags:
- rides
- visits
- member
summary: Get a filtered list of rides for a single member.
description: Get a filtered list of rides for a single member.
operationId: listRides
security:
- AppToken: []
parameters:
- name: page
in: query
description: Pagination page number
default: 1
required: false
type: integer
format: int64
- name: quantity
in: query
description: Pagination quantity per page
default: 10
type: integer
format: int64
responses:
200:
description: Rides paginated list
schema:
$ref: '#/definitions/RidePaginatedResponse'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
post:
tags:
- rides
- visits
- member
summary: Create a ride to a participating provider for an eligible member.
description: Get the ride
operationId: addRide
security:
- AppToken: []
parameters:
- name: data
in: body
description: Book a scheduled ride with at lease one ride_segment.
required: true
schema:
$ref: '#/definitions/RideRequest'
responses:
200:
description: Ride object with all the ID and remanescent parameters filled
schema:
$ref: '#/definitions/Ride'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/rides/{ride_uuid}/:
get:
tags:
- rides
- visits
- member
summary: Ride detail
description: Get a member's specific ride data
operationId: getRideDetail
security:
- AppToken: []
parameters:
- name: ride_uuid
in: path
description: Ride unique identifier
type: string
required: true
responses:
200:
description: Ride detail
schema:
$ref: '#/definitions/Ride'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
put:
tags:
- rides
- visits
- member
summary: Update member ride
description: Get the member ride
operationId: updateRides
security:
- AppToken: []
parameters:
- name: ride_uuid
in: path
description: Ride unique identifier
type: string
required: true
- name: data
in: body
description: Ride data
required: true
schema:
$ref: '#/definitions/Ride'
responses:
200:
description: Ride detail
schema:
$ref: '#/definitions/Ride'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/rides/{ride_uuid}/cancel:
post:
tags:
- rides
- visits
- member
summary: Cancel ride
description: Cancel a specific ride for a member
operationId: cancelRide
security:
- AppToken: []
parameters:
- name: ride_uuid
in: path
description: Ride unique identifier
type: string
required: true
responses:
204:
description: Empty response means that the cancel was aceppted
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/rides/{ride_uuid}/destination:
put:
tags:
- rides
- visits
- member
summary: Change the ride destination
description: Change the ride destination
operationId: changeRideDestination
security:
- AppToken: []
parameters:
- name: ride_uuid
in: path
description: Ride unique identifier
type: string
required: true
- name: data
in: body
description: Destination data
required: true
schema:
$ref: '#/definitions/Location'
responses:
200:
description: Location confirmation
schema:
$ref: '#/definitions/Location'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/ridetypes:
get:
tags:
- rides
security:
- AppToken: []
operationId: getRideTypes
summary: List the ride types
description: List the ride types from the database
parameters:
- name: lat
in: query
description: latitude
type: number
format: float
required: true
- name: lng
in: query
description: longitude
type: number
format: float
required: true
responses:
200:
description: Ride Type list
schema:
$ref: '#/definitions/RideTypeResponse'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/rideseta:
get:
tags:
- rides
security:
- AppToken: []
operationId: getRideEta
summary: Get the ETA of the Ride
description: Get the ETA of the types
parameters:
- name: lat
in: query
description: latitude
type: number
format: float
required: true
- name: lng
in: query
description: longitude
type: number
format: float
required: true
- name: dest_lat
in: query
description: destination latitude
type: number
format: float
required: true
- name: dest_lng
in: query
description: destination longitude
type: number
format: float
required: true
- name: ride_type_uuid
in: query
description: ride type UUID
type: string
responses:
200:
description: Ride ETA list
schema:
$ref: '#/definitions/RideETAResponse'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/ridedrivers:
get:
tags:
- rides
security:
- AppToken: []
operationId: getRideDrivers
summary: Get the Drivers close to the location
description: Get the Drivers close to the location
parameters:
- name: lat
in: query
description: latitude
type: number
format: float
required: true
- name: lng
in: query
description: longitude
type: number
format: float
required: true
- name: ride_type_uuid
in: query
description: ride type UUID
type: string
responses:
200:
description: Ride Drivers list
schema:
$ref: '#/definitions/RideDriverResponse'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/providers/:
get:
tags:
- rides
- providers
- member
summary: Get providers
description: Get a list of providers
operationId: getProviders
security:
- AppToken: []
parameters:
- name: page
in: query
description: Pagination page number
default: 1
required: false
type: integer
format: int64
- name: quantity
in: query
description: Pagination quantity per page
default: 10
type: integer
format: int64
responses:
200:
description: Provider list
schema:
$ref: '#/definitions/ProviderPaginatedResponse'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
/nemt/providers/{lat}/{lng}/:
get:
tags:
- rides
- providers
- member
summary: Provider by Location
description: Get a list of providers for a current location
operationId: getProvidersByLocation
security:
- AppToken: []
parameters:
- name: lat
in: path
description: latitude
type: number
format: float
required: true
- name: lng
in: path
description: longitude
type: number
format: float
required: true
- name: page
in: query
description: Pagination page number
default: 1
required: false
type: integer
format: int64
- name: quantity
in: query
description: Pagination quantity per page
default: 10
type: integer
format: int64
responses:
200:
description: Provider list
schema:
$ref: '#/definitions/ProviderPaginatedResponse'
401:
description: Unauthorized access
schema:
$ref: '#/definitions/DefaultErrorResponse'
422:
description: Validation error
schema:
$ref: '#/definitions/DefaultErrorResponse'
503:
description: Service Unavailable
schema:
$ref: '#/definitions/DefaultErrorResponse'
definitions:
DefaultErrorResponse:
type: object
description: Default error response data
properties:
error:
type: boolean
description: Indicates if the response is an error
message:
type: string
description: Detailed response message
AuthRequest:
type: object
description: Request from application authrization
properties:
email:
type: string
description: Member e-mail
password:
type: string
description: Base64 encoded password
AuthResponse:
type: object
description: Response from application authrization
properties:
token:
type: string
description: The token string for app authorization
valid_time:
type: integer
format: int64
description: Token expiration time in Unix time format
server_time:
type: integer
format: int64
description: Server time in Unix time format
PaginatedResponse:
type: object
description: Paginated response data
properties:
pagination:
type: object
description: Pagination data
properties:
total_records:
type: integer
format: int64
description: Total result count
records_per_page:
type: integer
format: int64
description: Max records per page
total_pages:
type: integer
format: int64
description: Total page count
current_page:
type: integer
format: int64
description: Current page number
data:
type: array
items:
type: object
description: Paginaged data
Member:
type: object
description: member data
properties:
member_uuid:
type: string
description: member unique ID
name:
type: string
description: Name
phone_number:
type: string
description: Phone number
MembersPaginatedResponse:
type: object
description: members paginated response data
allOf:
- $ref: '#/definitions/PaginatedResponse'
- properties:
data:
type: array
items:
$ref: '#/definitions/Member'
Driver:
type: object
description: Driver data
properties:
driver_uuid:
type: string
description: Driver unique ID
name:
type: string
description: Name
phone_number:
type: string
description: Phone number
vehicle:
type: object
description: Driver car description
$ref: '#/definitions/Vehicle'
Vehicle:
type: object
description: Veicule data
properties:
vehicle_uuid:
type: string
description: Vehicle unique ID
make:
type: string
description: Car brand
model:
type: string
description: Car model
plate:
type: string
description: Car plate
color:
type: string
description: Car color
Visit:
type: object
description: Visit data (Still TBD by the Data Model)
properties:
visit_uuid:
type: string
description: Visit unique ID
VisitsPaginatedResponse:
type: object
description: Visits paginated response data
allOf:
- $ref: '#/definitions/PaginatedResponse'
- properties:
data:
type: array
items:
$ref: '#/definitions/Visit'
Notification:
type: object
description: Notification data
properties:
notification_uuid:
type: string
description: Notification unique ID
notification:
type: string
description: Notification message
is_read:
type: boolean
description: Verify if the message was read
NotificationPaginatedResponse:
type: object
description: Notification paginated response data
allOf:
- $ref: '#/definitions/PaginatedResponse'
- properties:
data:
type: array
items:
$ref: '#/definitions/Notification'
RideRequest:
type: object
description: Visit data
properties:
ride_type:
type: object
description: Ride type
$ref: '#/definitions/RideType'
schedule_date:
type: string
format: datetime
description: Request date
coordinates:
type: object
description: Coordinates information
$ref: '#/definitions/RideCoordinates'
Ride:
type: object
description: Visit data
properties:
ride_uuid:
type: string
description: Ride unique ID
ride_type:
type: object
description: Ride type
$ref: '#/definitions/RideType'
ride_status:
type: object
description: Ride status
$ref: '#/definitions/RideStatus'
request_at:
type: string
format: datetime
description: Request date
driver:
type: object
description: Driver information
$ref: '#/definitions/Driver'
coordinates:
type: object
description: Coordinates information
$ref: '#/definitions/RideCoordinates'
RideCoordinates:
type: object
description: Ride coordinates properties
properties:
pickup:
type: object
description: Pickup information
$ref: '#/definitions/Location'
dropoff:
type: object
description: Dropoff information
$ref: '#/definitions/Location'
location:
type: object
description: Location information
$ref: '#/definitions/Location'
destination:
type: object
description: Destination information
$ref: '#/definitions/Location'
Location:
type: object
description: Location property
properties:
lat:
type: number
format: float
description: Latitude
lng:
type: number
format: float
description: Longitude
address:
type: string
description: Address
time:
type: string
format: datetime
description: Time
RidePaginatedResponse:
type: object
description: Ride paginated response data
allOf:
- $ref: '#/definitions/PaginatedResponse'
- properties:
data:
type: array
items:
$ref: '#/definitions/Ride'
Provider:
type: object
description: Provide data
properties:
provider_uuid:
type: string
description: Provider unique ID
npi_id:
type: integer
description: National Provider ID
provider_name:
type: string
description: Provider name
address:
type: string
description: Provider Address
lat:
type: number
format: float
description: Latitude
lng:
type: number
format: float
description: Longitude
ProviderPaginatedResponse:
type: object
description: Provider paginated response data
allOf:
- $ref: '#/definitions/PaginatedResponse'
- properties:
data:
type: array
items:
$ref: '#/definitions/Provider'
RideType:
properties:
ride_type_uuid:
type: string
description: Internal UUID of the ride type
ride_type:
type: string
description: Internal type of the ride type
display_name:
type: string
description: Ride type
RideStatus:
properties:
ride_status_uuid:
type: string
description: Internal UUID of the ride status
ride_status:
type: string
description: Internal type of the ride status
display_name:
type: string
description: Ride type
RideTypeResponse:
type: array
description: List of the Ride Types
items:
$ref: '#/definitions/RideType'
RideETA:
properties:
ride_type_uuid:
type: string
description: Internal UUID of the ride type
ride_type:
type: string
description: Internal type of the ride type
display_name:
type: string
description: Ride type
eta_seconds:
type: number
description: ETA
RideETAResponse:
type: array
description: List of the Ride ETA's
items:
$ref: '#/definitions/RideETA'
RideDriver:
properties:
ride_type_uuid:
type: string
description: Internal UUID of the ride type
ride_type:
type: string
description: Internal type of the ride type
display_name:
type: string
description: Ride type
drivers:
type: array
description: Drivers location
items:
$ref: '#/definitions/Location'
RideDriverResponse:
type: array
description: List the Ride Drivers by type
items:
$ref: '#/definitions/RideDriver'