api_v1.4/hub_api/docs/openapi-specs.yml
2023-03-06 10:56:46 -05:00

446 lines
17 KiB
YAML

info:
title: CERC API Swagger - OpenAPI 3.0
description: NextGen Cities Institute API
termsOfService: http://swagger.io/terms/
contact:
email: nextgen-cities@gmail.com
version: 1.4
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
paths:
/v1.4/uptime:
get:
parameters:
[]
tags:
- Uptime
summary: API uptime
operationId: uptime
description: Retrieve current API uptime
responses:
'200':
description: Request successful
content:
application/json:
schema:
$ref: '#/components/schemas/uptime'
/v1.4/session/start:
put:
parameters:
- in: header
name: username
schema:
type: string
required: true
description: the application username accessing this API
- in: header
name: password
schema:
type: string
required: true
description: the password for the user accessing this API
- in: header
name: application_uuid
schema:
type: string
required: true
description: the uuid of the application accessing this API
tags:
- Session start
summary: Starts an user session
operationId: session_start
description: Authentication and initialization of a user session in the Api
responses:
'200':
description: Login succeed
content:
application/json:
schema:
$ref: '#/components/schemas/login_succeed'
headers:
session_id:
type: string
format: uuid
description: Session id
example: '77e1c83b-7bb0-437b-bc50-a7a58e5660ac'
token:
type: string
format: uuid
description: Token expected in next operation header
example: '77e1c83b-7bb0-437b-bc50-a7a58e5660ac'
'403':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/unauthorized'
/v1.4/session/keep_alive:
put:
security:
- session_id: []
- token: []
- application_uuid: []
parameters:
[]
tags:
- Keep alive
summary: Keep the current user session alive
operationId: keep_alive
description: Refresh and keep the current session alive and renew the token
responses:
'200':
description: Succeed
content:
application/json:
schema:
$ref: '#/components/schemas/succeed'
headers:
token:
type: string
format: uuid
description: Token expected in next operation header
example: '77e1c83b-7bb0-437b-bc50-a7a58e5660ac'
'403':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/unauthorized'
/v1.4/session/end:
put:
security:
- session_id: []
- token: []
- application_uuid: []
parameters:
[]
tags:
- End session
summary: Ends the current user session
operationId: session_end
description: End the current user session and free the alocated resources
responses:
'200':
description: Succeed
content:
application/json:
schema:
$ref: '#/components/schemas/succeed'
headers:
token:
type: string
format: uuid
description: Token expected in next operation header
example: '77e1c83b-7bb0-437b-bc50-a7a58e5660ac'
'403':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/unauthorized'
/v1.4/buildings/meb:
post:
security:
- session_id: [ ]
- token: [ ]
- application_uuid: [ ]
requestBody:
content:
application/json:
schema:
type: object
properties:
cities:
type: object
example: {"city_1" :["building_1", "building_2"], "city_2" :["building_3", "building_8"]}
# schema:
# ref: '#components/schemas/buildingsArray'
# payload:
# type: object
# example: {"city_1" :["building_1", "building_2"], "city_2" :["building_3", "building_8"]}
# required: true
# description: Json containing the city name and the buildings whose monthly energy balance is requested.
tags:
- Buildings monthly energy balance meb
summary: Retrieve the monthly energy balance results for the given buildings in the given cities
operationId: building_monthly_energy_balance
description: Retrieve the monthly energy balance results for the given buildings in the given cities
responses:
'200':
description: Succeed
content:
application/json:
schema:
$ref: '#/components/schemas/meb'
headers:
token:
type: string
format: uuid
description: Token expected in next operation header
example: '77e1c83b-7bb0-437b-bc50-a7a58e5660ac'
'403':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/unauthorized'
components:
securitySchemes:
session_id:
type: apiKey
in: header
name: session_id
application_uuid:
type: apiKey
in: header
name: application_uuid
token:
type: apiKey
in: header
name: token
schemas:
uptime:
type: object
properties:
uptime:
type: string
format: hh:mm:ss.ms
example: '00:09:53.600281'
unauthorized:
type: object
properties:
error:
type: string
example: 'unauthorized'
succeed:
type: object
properties:
result:
type: string
example: 'succeed'
login_succeed:
type: object
properties:
result:
type: string
example: 'succeed'
cities:
type: array
example: [{'name': 'city 1', 'geometric_level_of_detail': '1'}, {'name': 'city 2', 'geometric_level_of_detail': '1'}]
buildingsArray:
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/buildings'
buildings:
type: object
properties:
city_id:
type: string
example: 'city_id1'
meb:
type: object
properties:
result:
type: string
example: 'succeed'
results:
type: string
example: '[
{
"city_1":{
"building_1":{
"insel meb":[
{
"monthly_cooling":{
"0":381853.821,
"1":484038.818,
"2":944923.8890000001,
"3":1465614.6200000001,
"4":2816751.71,
"5":4673754.8800000008,
"6":5804651.8600000003,
"7":5113784.1799999997,
"8":2464006.1000000001,
"9":1113856.5699999998,
"10":588973.45,
"11":384227.386
}
},
{
"yearly_cooling":{
"0":26236437.2839999981
}
},
{
"monthly_heating":{
"0":23752326.1999999993,
"1":20536490.1999999993,
"2":16533607.4000000004,
"3":8818033.1999999993,
"4":4036963.8700000001,
"5":915646.973,
"6":247277.222,
"7":393324.463,
"8":3161278.3199999998,
"9":8418375.9800000004,
"10":13028175.8000000007,
"11":21456785.1999999993
}
},
{
"yearly_heating":{
"0":121298284.8279999942
}
}
]
},
"building_2":{
"insel meb":[
{
"monthly_cooling":{
"0":3933853.0300000003,
"1":6749044.9199999999,
"2":12275707.0,
"3":15125280.3000000007,
"4":26189175.8000000007,
"5":38539007.799999997,
"6":44865269.5,
"7":42056718.8000000045,
"8":25809910.1999999993,
"9":12112115.1999999993,
"10":5266305.1800000006,
"11":3209882.3200000003
}
},
{
"yearly_cooling":{
"0":236132270.0499999821
}
},
{
"monthly_heating":{
"0":113151477.0,
"1":93304132.8000000119,
"2":67498476.599999994,
"3":27459867.1999999993,
"4":5259281.25,
"5":0.0,
"6":0.0,
"7":0.0,
"8":2118999.02,
"9":23991584.0,
"10":51830328.1000000015,
"11":101332000.0
}
},
{
"yearly_heating":{
"0":485946145.9700000286
}
}
]
}
}
},
{
"city_2":{
"building_3":{
"insel meb":[
{
"monthly_cooling":{
"0":1578142.8200000001,
"1":2491265.8700000001,
"2":4727943.8499999996,
"3":6648524.4100000001,
"4":12431965.8000000007,
"5":19330369.1000000015,
"6":22776884.8000000007,
"7":20448914.1000000015,
"8":11097510.7000000011,
"9":4935220.21,
"10":2247389.1600000001,
"11":1359069.3400000001
}
},
{
"yearly_cooling":{
"0":110073200.1600000113
}
},
{
"monthly_heating":{
"0":72041921.900000006,
"1":60658929.700000003,
"2":44862808.599999994,
"3":18590554.6999999993,
"4":3827654.3000000003,
"5":0.0,
"6":0.0,
"7":0.0,
"8":1737131.3500000001,
"9":16673425.8000000007,
"10":33768804.700000003,
"11":64228359.3999999985
}
},
{
"yearly_heating":{
"0":316389590.4499999881
}
}
]
},
"building_8":{
"insel meb":[
{
"monthly_cooling":{
"0":5984383.79,
"1":10543410.2000000011,
"2":20726748.0,
"3":25846933.6000000015,
"4":45066343.8000000045,
"5":65456738.299999997,
"6":74869429.6999999881,
"7":68197765.599999994,
"8":40489652.3000000045,
"9":18421974.6000000015,
"10":7668864.2600000007,
"11":4755506.3499999996
}
},
{
"yearly_cooling":{
"0":388027750.5000000596
}
},
{
"monthly_heating":{
"0":140609547.0,
"1":114809766.0,
"2":80985742.1999999881,
"3":32549675.8000000007,
"4":6437626.9500000002,
"5":0.0,
"6":0.0,
"7":0.0,
"8":2923770.5099999998,
"9":29677375.0,
"10":64619625.0,
"11":126441602.0
}
},
{
"yearly_heating":{
"0":599054730.4600000381
}
}
]
}
}
}
]'