{"openapi":"3.0.2","info":{"title":"Energinet Data API","description":"This is the Data API for accessing data on the Dataplatform _SQL Layer_ through HTTP.\n\nYou can `get` lists of available views, or `post` a select-query to retrieve some data.\n\nPlease review the documentation for the individual endpoints below.\n\n\n### Authentication methods\n- A `Service Principal` with credentials are required to query this API.\n- The `Service Principal` must be placed in a access-giving group through Omada.\n\n- While we're working on a smoother onboarding-experience, please use the contact mail below, to get started.\n\n### Authorization\nAuthorization is handled by the SQL backend and Azure Active Directory.\n\n\n**Please reach out, if you need help or something is not working as expected.**\n\n","contact":{"name":"Dataplatform","url":"https://data-api.dataplatform.energinet.dk/docs","email":"Data-Infrastruktur@energinet.dk"},"version":"1.3.0"},"paths":{"/data/":{"get":{"tags":["Data"],"summary":"Get a list of all views available","description":"This endpoints returns a list of views available to the given credentials.","operationId":"list_views_data__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"title":"Response List Views Data  Get","type":"array","items":{"$ref":"#/components/schemas/TableMetadata"}}}}}},"security":[{"HTTPBasic":[]}]}},"/data/{view_schema}.{view_name}":{"get":{"tags":["Data"],"summary":"Get metadata, and a list of columns and types, for a view","description":"This endpoint returns metadata for a specified view, such as `schema` and `name`, and a list of columns and their data types.","operationId":"get_single_view_data__view_schema___view_name__get","parameters":[{"description":"Name of the schema","required":true,"schema":{"title":"View Schema","type":"string","description":"Name of the schema"},"name":"view_schema","in":"path"},{"description":"Name of the view","required":true,"schema":{"title":"View Name","type":"string","description":"Name of the view"},"name":"view_name","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TableColumnMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBasic":[]}]}},"/data/{view_schema}.{view_name}/select":{"post":{"tags":["Data"],"summary":"Query a view for data","description":"This endpoint allows you to post a query, to retrieve data from a specified view.\nThe query model does limit the degree of conditions you can add, and as such you might need to do multiple queries, to get the full data you require.","operationId":"query_single_view_select_data__view_schema___view_name__select_post","parameters":[{"description":"Name of the schema","required":true,"schema":{"title":"View Schema","type":"string","description":"Name of the schema"},"name":"view_schema","in":"path"},{"description":"Name of the view","required":true,"schema":{"title":"View Name","type":"string","description":"Name of the view"},"name":"view_name","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelectQuery"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelectQueryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBasic":[]}]}}},"components":{"schemas":{"ColumnMetadata":{"title":"ColumnMetadata","required":["column_name","column_type"],"type":"object","properties":{"column_name":{"title":"Column Name","type":"string"},"column_type":{"title":"Column Type","type":"string"}}},"EWhereJoin":{"title":"EWhereJoin","enum":["AND","OR"],"type":"string","description":"An enumeration."},"EWhereOperator":{"title":"EWhereOperator","enum":["=","<=",">",">=","<","IN"],"type":"string","description":"An enumeration."},"HTTPValidationError":{"title":"HTTPValidationError","type":"object","properties":{"detail":{"title":"Detail","type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"SelectQuery":{"title":"SelectQuery","required":["columns"],"type":"object","properties":{"columns":{"title":"Columns","type":"array","items":{"type":"string"}},"order_by":{"title":"Order By","type":"string","description":"By default, the `order_by` will use the `columns` key, if not set."},"limit":{"title":"Limit","type":"integer","description":"Determines how many rows the query can return - max limit is 5000.","default":1000},"offset":{"title":"Offset","type":"integer","description":"Sets the offset of the returned rows, allowing to paginate the results.","default":0},"where_clauses":{"title":"Where Clauses","type":"array","items":{"$ref":"#/components/schemas/WhereClause"},"description":"Defines a list of where-clauses to execute. Note that when using `in` as the `where_operator`, parantheses will be added around the `where_condition` automatically."},"where_join":{"allOf":[{"$ref":"#/components/schemas/EWhereJoin"}],"default":"AND"}},"example":{"columns":["timestamp","valueA","valueB"],"order_by":"timestamp","limit":100,"offset":300,"where_clauses":[{"where_column":"valueA","where_operator":">=","where_condition":50},{"where_column":"valueB","where_operator":"IN","where_condition":"1, 2, 3"}],"where_join":"AND"}},"SelectQueryResponse":{"title":"SelectQueryResponse","required":["rows"],"type":"object","properties":{"rows":{"title":"Rows","type":"array","items":{"type":"object"}},"next_offset":{"title":"Next Offset","type":"integer","description":"This will be an integer stating which offset the client should call to get the next \"page\" of results. There is no guarantee that there are any more data, so the client needs to handle an empty response."}}},"TableColumnMetadata":{"title":"TableColumnMetadata","required":["table_schema","table_name","table_columns"],"type":"object","properties":{"table_schema":{"title":"Table Schema","type":"string"},"table_name":{"title":"Table Name","type":"string"},"table_columns":{"title":"Table Columns","type":"array","items":{"$ref":"#/components/schemas/ColumnMetadata"}}}},"TableMetadata":{"title":"TableMetadata","required":["table_schema","table_name"],"type":"object","properties":{"table_schema":{"title":"Table Schema","type":"string"},"table_name":{"title":"Table Name","type":"string"}}},"ValidationError":{"title":"ValidationError","required":["loc","msg","type"],"type":"object","properties":{"loc":{"title":"Location","type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}}},"WhereClause":{"title":"WhereClause","required":["where_column","where_condition"],"type":"object","properties":{"where_column":{"title":"Where Column","type":"string"},"where_operator":{"allOf":[{"$ref":"#/components/schemas/EWhereOperator"}],"default":"="},"where_condition":{"title":"Where Condition","type":"string"}}}},"securitySchemes":{"HTTPBasic":{"type":"http","description":"`Username` should be the `client_id` of the Service Principal, and _not_ the `Display Name` property or similar.<br />\n                `Password` should be the `client_secret` of the Service Principal.","scheme":"basic"}}},"tags":[{"name":"Data","description":"Methods for retrieving metadata and data for tables on the Dataplatform *Uniform*-layer."}]}