api_v1.4/hub_api/docs/openapi-specs.yml

407 lines
11 KiB
YAML
Raw Normal View History

info:
title: Gamification Swagger - OpenAPI 3.0
description: NextGen Cities Institute Gamification API
termsOfService: http://swagger.io/terms/
contact:
2023-01-30 19:45:02 -05:00
email: nextgen-cities@gmail.com
version: 1.4
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
paths:
/v1.4/city:
post:
tags:
- city
summary: Create a city
operationId: createCity
description: Create a new city with a file upoload
parameters:
- in: header
name: appId
schema:
type: string
required: true
description: the Id of the application access this API
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
city_file:
type: string
format: binary
required: true
responses:
'201':
description: City created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/City'
'200':
description: City not created
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'404':
description: City not found
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
security:
- BearerAuth: []
/v1.4/city/{city_id}:
get:
tags:
- city
summary: Get a city
operationId: getCity
description: Retrieve a city with a given city ID
parameters:
- in: header
name: appId
schema:
type: string
required: true
description: the ID of the application access this API
- in: path
name: city_id
schema:
type: integer
required: true
description: Numeric ID of the city to get
responses:
'200':
2023-01-30 19:45:02 -05:00
description: City retrieved successfully
content:
application/json:
schema:
$ref: '#/components/schemas/City'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'404':
description: City not found
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
security:
- BearerAuth: [ ]
/v1.4/user:
post:
tags:
- user
summary: Create user
description: This can only be done by the logged in admin.
operationId: createUser
parameters:
- in: header
name: appId
schema:
type: string
required: true
description: the Id of the application access this API
requestBody:
description: Created user object
content:
application/json:
schema:
$ref: '#/components/schemas/User'
application/xml:
schema:
$ref: '#/components/schemas/User'
responses:
'201':
description: User created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
security:
- BearerAuth: [ ]
put:
tags:
- user
summary: Update user
description: This can only be done by the logged in admin.
operationId: updateUser
requestBody:
description: Update user object
content:
application/json:
schema:
$ref: '#/components/schemas/User'
application/xml:
schema:
$ref: '#/components/schemas/User'
responses:
'201':
description: User updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/User'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'403':
description: Forbidden
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
security:
- BearerAuth: [ ]
/v1.4/user/login:
post:
tags:
- user
summary: Logs user into the system
description: ''
operationId: loginUser
parameters:
- in: header
name: appId
schema:
type: string
required: true
description: the Id of the application access this API
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Login'
required: true
responses:
'200':
description: Login successful
content:
application/json:
schema:
$ref: '#/components/schemas/LoginRes'
'400':
description: Invalid username/password supplied
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
components:
schemas:
City:
type: object
properties:
id:
type: integer
format: int64
example: 10
name:
type: string
example: Montreal
srs_name:
type: string
example: EPSG:26918
country:
type: string
example: ca
lon:
type: float
example: 0.38292983
lat:
type: float
example: 0.92898883
time_zone:
type: string
example: utc
city_version:
type: integer
format: int64
example: 1
lower_corner:
type: array
items:
type: float
example: [610610.7547462888,5035770.347264212,566.5784301757819]
upper_corner:
type: array
items:
type: float
example: [610610.7547462888,5035770.347264212,566.5784301757819]
user:
type: object
$ref: '#/components/schemas/User'
created:
type: string
example: 2023-01-15 18:40:54.64877
updated:
type: string
example: 2023-01-15 18:40:54.64877
User:
type: object
properties:
id:
type: integer
format: int64
example: 10
name:
type: string
example: Peter Yefi
email:
type: string
format: email
example: peteryefi@gmail.com
password:
type: string
example: 'Hub@183838'
role:
type: string
enum:
- Admin
- Hub_Reader
required:
- name
- email
- password
- role
Login:
type: object
properties:
email:
type: string
example: peteryefi@gmail.com
password:
type: string
example: 'Hub@183838'
required:
- email
- password
LoginRes:
type: object
properties:
token:
type: string
example: eylskdkdjfkdj67uhbnmkhbn908uyhndh
user:
type: object
$ref: '#/components/schemas/User'
ApiResponse:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
requestBodies:
User:
2023-01-30 19:45:02 -05:00
description: User object that is to be created
content:
application/json:
schema:
$ref: '#/components/schemas/User'
application/xml:
schema:
$ref: '#/components/schemas/User'
CityArray:
description: List of city object
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/City'
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT