{"openapi":"3.0.0","info":{"version":"0.0.1","title":"Aareon Smart Platform - Energy Consumption Data","description":"Aareon Smart Platform provides a set of APIs."},"servers":[{"url":"https://smartcontracts-develop.dev.aareonit.fr/","description":"Internal development server, for developers testing purpose."},{"url":"https://smartcontracts-develop.test.aareonit.fr/","description":"Staging server, for business testing purpose."},{"url":"https://smartcontracts.prod.aareonit.fr/","description":"Production server"}],"tags":[{"name":"Consumption Data","description":"Service to retrieve relevant consumption data to the end user"},{"name":"Consumption Data: Energy context","description":"Service to retrieve relevant energy consumption data to the end user"}],"security":[{"jwt":[]}],"paths":{"/":{"head":{"summary":"Checks the microservice health.","operationId":"HealthCheck","description":"Provides a no content response from the micro service.","tags":["Consumption Data"],"security":[],"responses":{"204":{"$ref":"#/components/responses/default_204"}}}},"/energy/usages_records":{"post":{"summary":"Creates an energy usage records according to the contract and the requested information.","operationId":"CreateEnergyUsageRecords","description":"Creates an energy usage records according to the contract context, the contract information and the requested information.","tags":["Consumption Data: Energy context"],"requestBody":{"$ref":"#/components/requestBodies/create_energy_usage_records_data_model"},"parameters":[{"$ref":"#/components/parameters/tenantId"},{"$ref":"#/components/parameters/xTenantId"},{"$ref":"#/components/parameters/fingerprint"}],"responses":{"200":{"$ref":"#/components/responses/energy_usage_records_information_responses"},"400":{"$ref":"#/components/responses/default_400"},"401":{"$ref":"#/components/responses/default_401"},"403":{"$ref":"#/components/responses/default_403"},"500":{"$ref":"#/components/responses/default_500"},"502":{"$ref":"#/components/responses/default_502"},"503":{"$ref":"#/components/responses/default_503"}}}}},"components":{"schemas":{"energy_usage_records_data_model":{"type":"object","required":["contract"],"properties":{"contract":{"$ref":"#/components/schemas/contract_data_model"},"period":{"type":"array","items":{"$ref":"#/components/schemas/period_data_model"}}}},"energy_usage_records_data_responses":{"type":"object","properties":{"results":{"allOf":[{"$ref":"#/components/schemas/energy_data_response_model"},{"$ref":"#/components/schemas/energy_category_response_model"}]}}},"energy_data_response_model":{"type":"object","properties":{"usage_records":{"type":"object","description":"Details about the usage records of each energy type response object.","additionalProperties":{"$ref":"#/components/schemas/energy_response_model"},"example":{"1234":{"id":1234,"category_id":"#/results/categories/45","type":"Centralize heat system","description":"home centralization","start_date":"2020-01-01","end_date":"2020-12-31","usage":49749,"usage_unit":"kwh","price":33,"price_unit":"eur"},"4321":{"id":4321,"category_id":"#/results/categories/33","type":"Cold water","description":"cold water","start_date":"2020-01-01","end_date":"2020-06-1","usage":42,"usage_unit":"litter","price":0.01,"price_unit":"eur"},"319":{"id":319,"category_id":"#/results/categories/33","type":"Cold water","description":"cold water","start_date":"2020-04-01","end_date":"2020-06-1","usage":500,"usage_unit":"litter","price":0.1,"price_unit":"eur"}}}}},"energy_response_model":{"type":"object","properties":{"id":{"type":"integer","example":33532},"category_id":{"type":"string","description":"Json path of the associated category on the same results.","example":33},"type":{"type":"string","description":"Type of the consumption.","example":"Cold water."},"description":{"type":"string","description":"Description of the type of energy."},"start_date":{"$ref":"#/components/schemas/start_date_data_model"},"end_date":{"$ref":"#/components/schemas/end_date_data_model"},"usage":{"type":"integer","description":"Usage measure of the energy type.","example":10},"usage_unit":{"type":"string","description":"Unit of measurement of the energy type (litter, kilowatt)","example":"litter"},"price":{"type":"integer","description":"Price of the usage.","example":150},"price_unit":{"type":"string","description":"Currency specified for the price.","example":"eur"}}},"energy_category_response_model":{"type":"object","properties":{"categories":{"$ref":"#/components/schemas/category_response_model"}}},"category_response_model":{"type":"object","additionalProperties":{"type":"object","properties":{"id":{"type":"integer","example":45},"category":{"type":"string","description":"Energy category.","example":"Heat."},"usage_records_ids":{"type":"array","items":{"type":"string","description":"Json path of the associated usage_records on the same results.","example":"#/results/usage_records/319"}}}},"example":{"45":{"id":45,"category":"heat","usage_records_ids":["#/results/usage_records/1234"]},"33":{"id":33,"category":"water","usage_records_ids":["#/results/usage_records/4321","#/results/usage_records/319"]}}},"contract_data_model":{"type":"integer","description":"Identifier of the contract.","example":"12947"},"period_data_model":{"$ref":"#/components/schemas/start_end_data_model"},"start_end_data_model":{"type":"object","properties":{"start_date":{"$ref":"#/components/schemas/start_date_data_model"},"end_date":{"$ref":"#/components/schemas/end_date_data_model"}}},"start_date_data_model":{"type":"string","format":"date","pattern":"YYYY-MM","description":"Representation of the start date for the requested period.","example":"2020-01"},"end_date_data_model":{"type":"string","format":"date","pattern":"YYYY-MM","description":"Representation of the end date for the requested period.","example":"2020-01"}},"securitySchemes":{"jwt":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"parameters":{"tenantId":{"name":"TENANT-ID","in":"header","description":"Tenant identifier in a multi-tenant strategy.","required":true,"deprecated":false,"style":"simple","explode":false,"schema":{"type":"string"},"example":"tenantName_a1b2c3d4e5"},"xTenantId":{"name":"X-TENANT-ID","in":"header","description":"Tenant identifier in a multi-tenant strategy (old way). Please use TENANT-ID instead.","required":false,"deprecated":true,"style":"simple","explode":false,"schema":{"type":"string"},"example":"tenantName_a1b2c3d4e5"},"fingerprint":{"name":"fingerprint","in":"header","description":"Fingerprint used in the authentication process. Must be unique for all device using the APIs.","required":true,"deprecated":false,"style":"simple","explode":false,"schema":{"type":"string"},"example":"ThisIsSecretFingerprintFromClient"}},"requestBodies":{"create_energy_usage_records_data_model":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/energy_usage_records_data_model"}]}}}}},"responses":{"energy_usage_records_information_responses":{"description":"Successful response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/energy_usage_records_data_responses"}}}},"default_204":{"description":"No Content"},"default_400":{"description":"Bad request. Possibilities are multiple. For instance: empty or invalid body, unresolved parameters, ...","content":{"application/json":{"schema":{"required":["error","error_description","code"],"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"error":{"type":"string","description":"Message regarding the error","example":"Validation error [requested_parameter]"},"error_description":{"type":"string","description":"Message description regarding the error.","example":"The provide information must be an integer"},"code":{"type":"string","description":"Code according to error"}}}}},"additionalProperties":false,"readOnly":true}}}},"default_401":{"description":"Unauthenticated, authentication key is missing.","content":{"application/json":{"schema":{"required":["status"],"type":"object","properties":{"status":{"enum":["NO_AUTHORIZATION","NO_TOKEN","INVALID_TOKEN","FINGERPRINT_MISMATCH","LOGGED_OUT","SESSION_IDLE"],"type":"string"}},"additionalProperties":false,"description":"Status returned by the gateway to explain the reason of the deny of the authentication.","readOnly":true}}}},"default_403":{"description":"Forbidden: the requester has no privileges to access to this route.","content":{"application/json":{"schema":{"required":["status"],"type":"object","properties":{"status":{"enum":["403 Access forbidden, user has no right to access the data."],"type":"string"}},"additionalProperties":false,"description":"Status returned by the gateway to explain why this route is denied for the current user.","readOnly":true}}}},"default_404":{"description":"Not found: there are no resources with the given identifiers.","content":{"application/json":{"schema":{"required":["status"],"type":"object","properties":{"status":{"enum":["URL Not found."],"type":"string"}},"additionalProperties":false,"readOnly":true}}}},"default_500":{"description":"Internal server error.\nThis is probably due to an application error that must be fixed, if relevant.\nPlease contact the administrator using the contact email on top of this document and, whenever possible,\ngive the URL, method, request headers, request body, response headers and response body in the mail.","content":{"application/json":{"schema":{"required":["error","error_description","code"],"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"error":{"type":"string","description":"Message regarding the error","example":"Internal Server Error"},"error_description":{"type":"string","description":"Message description regarding the error.","example":"There was an error while trying to process your request"},"code":{"type":"string","description":"Code according to error"}}}}},"additionalProperties":false,"readOnly":true}}}},"default_502":{"description":"Bad gateway: the service is not available while its server configuration is up.\nThe service might be busy with other requests and could not handle this one. Try again later.\nIf this response is still obtained when trying again, please contact the administrator using the email\non top of this document and, whenever possible, give the URL, method, request headers and request body in\nthe mail."},"default_503":{"description":"Service unavailable: the service is down.\nPlease contact the administrator using the contact email on top of this document and, whenever possible,\ngive the URL, method and request headers in the mail."}}}}