# Data Warehouse

Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems.

## GET /datawarehouses/{datawarehouse\_id}

> Retrieve a DataWarehouse

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}":{"get":{"tags":["Data Warehouse"],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["data","status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseResource"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"parameters":[{"name":"datawarehouse_id","description":"The data warehouse the credentials give access to","schema":{"type":"string"},"required":true,"in":"path"}],"description":"","summary":"Retrieve a DataWarehouse","operationId":"getDataWarehouse"}}},"components":{"schemas":{"DataWarehouseResource":{"required":["description","engine_type","id","name","organisation_id"],"type":"object","properties":{"name":{"type":"string","readOnly":false},"description":{"type":"string","readOnly":false},"organisation_id":{"type":"string","readOnly":true},"location":{"type":"string","readOnly":false},"engine_type":{"$ref":"#/components/schemas/DataWarehouseEngineType"},"id":{"type":"string","readOnly":true}}},"DataWarehouseEngineType":{"type":"string","readOnly":false,"enum":["BIG_QUERY","POSTGRES","SNOWFLAKE"]},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## PUT /datawarehouses/{datawarehouse\_id}

> Update a DataWarehouse

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}":{"put":{"summary":"Update a DataWarehouse","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["data","status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseResource"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"requestBody":{"description":"The datamart to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseResource"}}},"required":true},"operationId":"updateDataWarehouse","tags":["Data Warehouse"],"description":"","parameters":[{"in":"path","name":"datawarehouse_id","schema":{"type":"string"},"description":"The data warehouse the credentials give access to","required":true}]}}},"components":{"schemas":{"DataWarehouseResource":{"required":["description","engine_type","id","name","organisation_id"],"type":"object","properties":{"name":{"type":"string","readOnly":false},"description":{"type":"string","readOnly":false},"organisation_id":{"type":"string","readOnly":true},"location":{"type":"string","readOnly":false},"engine_type":{"$ref":"#/components/schemas/DataWarehouseEngineType"},"id":{"type":"string","readOnly":true}}},"DataWarehouseEngineType":{"type":"string","readOnly":false,"enum":["BIG_QUERY","POSTGRES","SNOWFLAKE"]},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## DELETE /datawarehouses/{datawarehouse\_id}

> Delete a DataWarehouse

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}":{"delete":{"parameters":[{"name":"datawarehouse_id","schema":{"type":"string"},"in":"path","description":"The data warehouse the credentials give access to","required":true}],"description":"","responses":{"200":{"description":"Success response","content":{"application/json":{"schema":{"required":["status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"tags":["Data Warehouse"],"operationId":"deleteDataWarehouse","summary":"Delete a DataWarehouse"}}},"components":{"schemas":{"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## GET /datawarehouses/{datawarehouse\_id}/columns/{column\_id}

> Retrieve a column context from its id

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/columns/{column_id}":{"get":{"tags":["Data Warehouse"],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["data","status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseTableColumnContextResource"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"operationId":"getColumnContext","parameters":[{"schema":{"type":"string"},"required":true,"description":"The data warehouse","name":"datawarehouse_id","in":"path"},{"required":true,"schema":{"type":"string"},"name":"column_id","in":"path","description":"The data warehouse column"}],"summary":"Retrieve a column context from its id","description":""}}},"components":{"schemas":{"DataWarehouseTableColumnContextResource":{"required":["column_name","data_warehouse_id","data_warehouse_name","database_id","database_name","id","schema_id","schema_name","table_id","table_name"],"type":"object","properties":{"schema_id":{"type":"string","readOnly":false},"data_warehouse_id":{"type":"string","readOnly":false},"data_warehouse_name":{"type":"string","readOnly":false},"table_id":{"type":"string","readOnly":false},"database_name":{"type":"string","readOnly":false},"database_id":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":false},"column_name":{"type":"string","readOnly":false},"table_name":{"type":"string","readOnly":false},"schema_name":{"type":"string","readOnly":false}}},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## GET /datawarehouses

> Find DataWarehouses

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses":{"get":{"summary":"Find DataWarehouses","parameters":[{"schema":{"type":"integer","format":"int64"},"description":"The data warehouse owning the tables","name":"organisation_id","in":"query","required":true},{"description":"Offset from which the search must be performed","schema":{"type":"integer","format":"int32"},"required":false,"name":"first_result","in":"query"},{"required":false,"description":"Number of maximum items that shall be return by this search","name":"max_results","in":"query","schema":{"type":"integer","format":"int32"}}],"operationId":"findDataWarehouses","tags":["Data Warehouse"],"description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["count","data","first_result","max_results","status","total"],"type":"object","properties":{"first_result":{"type":"integer"},"count":{"type":"integer"},"total":{"type":"integer"},"max_results":{"type":"integer"},"status":{"type":"string","enum":["ok"]},"data":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseResource"}}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}},"components":{"schemas":{"DataWarehouseResource":{"required":["description","engine_type","id","name","organisation_id"],"type":"object","properties":{"name":{"type":"string","readOnly":false},"description":{"type":"string","readOnly":false},"organisation_id":{"type":"string","readOnly":true},"location":{"type":"string","readOnly":false},"engine_type":{"$ref":"#/components/schemas/DataWarehouseEngineType"},"id":{"type":"string","readOnly":true}}},"DataWarehouseEngineType":{"type":"string","readOnly":false,"enum":["BIG_QUERY","POSTGRES","SNOWFLAKE"]},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## POST /datawarehouses

> Create a DataWarehouse

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses":{"post":{"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["data","status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseResource"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"requestBody":{"description":"The datamart to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseResource"}}},"required":true},"description":"","operationId":"createDataWarehouse","summary":"Create a DataWarehouse","tags":["Data Warehouse"]}}},"components":{"schemas":{"DataWarehouseResource":{"required":["description","engine_type","id","name","organisation_id"],"type":"object","properties":{"name":{"type":"string","readOnly":false},"description":{"type":"string","readOnly":false},"organisation_id":{"type":"string","readOnly":true},"location":{"type":"string","readOnly":false},"engine_type":{"$ref":"#/components/schemas/DataWarehouseEngineType"},"id":{"type":"string","readOnly":true}}},"DataWarehouseEngineType":{"type":"string","readOnly":false,"enum":["BIG_QUERY","POSTGRES","SNOWFLAKE"]},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## GET /datawarehouses/{datawarehouse\_id}/metadata

> Fetch data warehouse database metadata

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/metadata":{"get":{"parameters":[{"description":"The data warehouse owning the tables","name":"datawarehouse_id","schema":{"type":"string"},"in":"path","required":true},{"name":"include_disappeared","description":"Include elements with an non null disappearance date","required":false,"schema":{"type":"boolean"},"in":"query"}],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["data","status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseInfosResource"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"summary":"Fetch data warehouse database metadata","tags":["Data Warehouse"],"operationId":"getDatabasesMetadata","description":""}}},"components":{"schemas":{"DataWarehouseInfosResource":{"required":["databases","id","name"],"type":"object","properties":{"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"databases":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseDatabaseInfosResource"}}}},"DataWarehouseDatabaseInfosResource":{"required":["data_warehouse_id","discovery_date","id","last_seen_date","name","schemas"],"type":"object","properties":{"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"schemas":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseSchemaInfosResource"}},"disappearance_date":{"type":"integer","format":"int64","readOnly":true,"default":0},"name":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","readOnly":true,"default":0},"last_seen_date":{"type":"integer","format":"int64","readOnly":true,"default":0}}},"DataWarehouseSchemaInfosResource":{"required":["discovery_date","id","last_seen_date","name","tables"],"type":"object","properties":{"discovery_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"tables":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseTableInfosResource"}},"id":{"type":"string","readOnly":false},"last_seen_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"name":{"type":"string","readOnly":false}}},"DataWarehouseTableInfosResource":{"required":["columns","discovery_date","has_read_access","id","last_seen_date","name"],"type":"object","properties":{"id":{"type":"string","readOnly":true},"has_read_access":{"type":"boolean","readOnly":false,"default":false},"disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"read_access_disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"discovery_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"columns":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseTableColumnResource"}},"name":{"type":"string","readOnly":false},"last_seen_date":{"type":"integer","format":"int64","readOnly":false,"default":0}}},"DataWarehouseTableColumnResource":{"required":["column_name","discovery_date","id","index","last_seen_date","nullable","primary_key","repeated","type_name"],"type":"object","properties":{"type_name":{"type":"string","readOnly":false},"column_name":{"type":"string","readOnly":false},"last_seen_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"repeated":{"type":"boolean","readOnly":false,"default":false},"primary_key":{"type":"boolean","readOnly":false,"default":false},"disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"index":{"type":"integer","format":"int32","readOnly":false,"default":0},"nullable":{"type":"boolean","readOnly":false,"default":false},"id":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","readOnly":false,"default":0}}},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## POST /datawarehouses/{datawarehouse\_id}/metadata

> Fetch tables metadata from big query

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/metadata":{"post":{"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["data","status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseInfosResource"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"requestBody":{"description":"The gcp service account to register","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseFetchMetadataRequest"}}},"required":true},"description":"","operationId":"fetchExternalMetadata","tags":["Data Warehouse"],"summary":"Fetch tables metadata from big query","parameters":[{"in":"path","schema":{"type":"string"},"required":true,"name":"datawarehouse_id","description":"The data warehouse owning the tables"}]}}},"components":{"schemas":{"DataWarehouseInfosResource":{"required":["databases","id","name"],"type":"object","properties":{"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"databases":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseDatabaseInfosResource"}}}},"DataWarehouseDatabaseInfosResource":{"required":["data_warehouse_id","discovery_date","id","last_seen_date","name","schemas"],"type":"object","properties":{"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"schemas":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseSchemaInfosResource"}},"disappearance_date":{"type":"integer","format":"int64","readOnly":true,"default":0},"name":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","readOnly":true,"default":0},"last_seen_date":{"type":"integer","format":"int64","readOnly":true,"default":0}}},"DataWarehouseSchemaInfosResource":{"required":["discovery_date","id","last_seen_date","name","tables"],"type":"object","properties":{"discovery_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"tables":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseTableInfosResource"}},"id":{"type":"string","readOnly":false},"last_seen_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"name":{"type":"string","readOnly":false}}},"DataWarehouseTableInfosResource":{"required":["columns","discovery_date","has_read_access","id","last_seen_date","name"],"type":"object","properties":{"id":{"type":"string","readOnly":true},"has_read_access":{"type":"boolean","readOnly":false,"default":false},"disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"read_access_disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"discovery_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"columns":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseTableColumnResource"}},"name":{"type":"string","readOnly":false},"last_seen_date":{"type":"integer","format":"int64","readOnly":false,"default":0}}},"DataWarehouseTableColumnResource":{"required":["column_name","discovery_date","id","index","last_seen_date","nullable","primary_key","repeated","type_name"],"type":"object","properties":{"type_name":{"type":"string","readOnly":false},"column_name":{"type":"string","readOnly":false},"last_seen_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"repeated":{"type":"boolean","readOnly":false,"default":false},"primary_key":{"type":"boolean","readOnly":false,"default":false},"disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"index":{"type":"integer","format":"int32","readOnly":false,"default":0},"nullable":{"type":"boolean","readOnly":false,"default":false},"id":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","readOnly":false,"default":0}}},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}},"DataWarehouseFetchMetadataRequest":{"required":["fetch_only"],"type":"object","properties":{"fetch_only":{"type":"boolean","readOnly":false,"default":false}}}}}}
```

## GET /datamarts/{datamart\_id}/datawarehouses/{datawarehouse\_id}/config

> Retrieve a DataWarehouse Datamart Config

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/datawarehouses/{datawarehouse_id}/config":{"get":{"parameters":[{"description":"The datamart id","name":"datamart_id","in":"path","schema":{"type":"string"},"required":true},{"name":"datawarehouse_id","schema":{"type":"string"},"required":true,"description":"The data warehouse id","in":"path"}],"summary":"Retrieve a DataWarehouse Datamart Config","description":"","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["data","status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseDatamartConfigResource"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"tags":["Data Warehouse"],"operationId":"findDataWarehouseDatamartConfig"}}},"components":{"schemas":{"DataWarehouseDatamartConfigResource":{"required":["created_ts","data_warehouse_id","datamart_id","id"],"type":"object","properties":{"working_schema_name":{"type":"string","readOnly":false},"created_ts":{"type":"integer","format":"int64","readOnly":true,"default":0},"id":{"type":"string","readOnly":true},"data_warehouse_id":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":false},"last_modified_ts":{"type":"integer","format":"int64","readOnly":true,"default":0}}},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## PUT /datamarts/{datamart\_id}/datawarehouses/{datawarehouse\_id}/config

> Upsert a DataWarehouse Datamart Config

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/datawarehouses/{datawarehouse_id}/config":{"put":{"requestBody":{"description":"The datamart config to upsert","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseDatamartConfigResource"}}},"required":true},"operationId":"upsertDataWarehouseDatamartConfig","tags":["Data Warehouse"],"description":"","summary":"Upsert a DataWarehouse Datamart Config","parameters":[{"name":"datamart_id","description":"The datamart id","in":"path","schema":{"type":"string"},"required":true},{"required":true,"in":"path","description":"The data warehouse id","schema":{"type":"string"},"name":"datawarehouse_id"}],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["data","status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseDatamartConfigResource"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}},"components":{"schemas":{"DataWarehouseDatamartConfigResource":{"required":["created_ts","data_warehouse_id","datamart_id","id"],"type":"object","properties":{"working_schema_name":{"type":"string","readOnly":false},"created_ts":{"type":"integer","format":"int64","readOnly":true,"default":0},"id":{"type":"string","readOnly":true},"data_warehouse_id":{"type":"string","readOnly":false},"datamart_id":{"type":"string","readOnly":false},"last_modified_ts":{"type":"integer","format":"int64","readOnly":true,"default":0}}},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## DELETE /datamarts/{datamart\_id}/datawarehouses/{datawarehouse\_id}/config

> Delete a DataWarehouse Datamart Config

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datamarts/{datamart_id}/datawarehouses/{datawarehouse_id}/config":{"delete":{"parameters":[{"required":true,"name":"datamart_id","in":"path","schema":{"type":"string"},"description":"The datamart id"},{"in":"path","name":"datawarehouse_id","schema":{"type":"string"},"required":true,"description":"The data warehouse id"}],"description":"","responses":{"200":{"description":"Success response","content":{"application/json":{"schema":{"required":["status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"operationId":"deleteDataWarehouseDatamartConfig","tags":["Data Warehouse"],"summary":"Delete a DataWarehouse Datamart Config"}}},"components":{"schemas":{"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## GET /datawarehouses/{datawarehouse\_id}/databases

> Find DataWarehouse databases

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/databases":{"get":{"operationId":"findDataWarehouseDatabases","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["count","data","first_result","max_results","status","total"],"type":"object","properties":{"max_results":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseDatabaseResource"}},"total":{"type":"integer"},"status":{"type":"string","enum":["ok"]},"first_result":{"type":"integer"},"count":{"type":"integer"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"tags":["Data Warehouse"],"parameters":[{"description":"The data warehouse owning the databases","name":"datawarehouse_id","schema":{"type":"string"},"required":true,"in":"path"},{"name":"first_result","description":"Offset from which the search must be performed","in":"query","schema":{"type":"integer","format":"int32"},"required":false},{"schema":{"type":"integer","format":"int32"},"name":"max_results","in":"query","description":"Number of maximum items that shall be return by this search","required":false}],"description":"","summary":"Find DataWarehouse databases"}}},"components":{"schemas":{"DataWarehouseDatabaseResource":{"required":["data_warehouse_id","discovery_date","id","name"],"type":"object","properties":{"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","readOnly":true,"default":0}}},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## POST /datawarehouses/{datawarehouse\_id}/databases

> Create database

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/databases":{"post":{"parameters":[{"in":"path","schema":{"type":"string"},"name":"datawarehouse_id","required":true,"description":"The data warehouse owning the databases"}],"summary":"Create database","description":"","requestBody":{"description":"The gcp service account to register","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseDatabaseInfosListResource"}}},"required":true},"tags":["Data Warehouse"],"operationId":"createDatabase","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["count","data","first_result","max_results","status","total"],"type":"object","properties":{"total":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/DataWarehouseDatabaseInfosResource"}},"count":{"type":"integer"},"status":{"type":"string","enum":["ok"]},"max_results":{"type":"integer"},"first_result":{"type":"integer"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}},"components":{"schemas":{"DataWarehouseDatabaseInfosListResource":{"required":["databases"],"type":"object","properties":{"databases":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseDatabaseInfosResource"}}}},"DataWarehouseDatabaseInfosResource":{"required":["data_warehouse_id","discovery_date","id","last_seen_date","name","schemas"],"type":"object","properties":{"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"schemas":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseSchemaInfosResource"}},"disappearance_date":{"type":"integer","format":"int64","readOnly":true,"default":0},"name":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","readOnly":true,"default":0},"last_seen_date":{"type":"integer","format":"int64","readOnly":true,"default":0}}},"DataWarehouseSchemaInfosResource":{"required":["discovery_date","id","last_seen_date","name","tables"],"type":"object","properties":{"discovery_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"tables":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseTableInfosResource"}},"id":{"type":"string","readOnly":false},"last_seen_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"name":{"type":"string","readOnly":false}}},"DataWarehouseTableInfosResource":{"required":["columns","discovery_date","has_read_access","id","last_seen_date","name"],"type":"object","properties":{"id":{"type":"string","readOnly":true},"has_read_access":{"type":"boolean","readOnly":false,"default":false},"disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"read_access_disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"discovery_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"columns":{"type":"array","readOnly":false,"items":{"$ref":"#/components/schemas/DataWarehouseTableColumnResource"}},"name":{"type":"string","readOnly":false},"last_seen_date":{"type":"integer","format":"int64","readOnly":false,"default":0}}},"DataWarehouseTableColumnResource":{"required":["column_name","discovery_date","id","index","last_seen_date","nullable","primary_key","repeated","type_name"],"type":"object","properties":{"type_name":{"type":"string","readOnly":false},"column_name":{"type":"string","readOnly":false},"last_seen_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"repeated":{"type":"boolean","readOnly":false,"default":false},"primary_key":{"type":"boolean","readOnly":false,"default":false},"disappearance_date":{"type":"integer","format":"int64","readOnly":false,"default":0},"index":{"type":"integer","format":"int32","readOnly":false,"default":0},"nullable":{"type":"boolean","readOnly":false,"default":false},"id":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","readOnly":false,"default":0}}},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## GET /datawarehouses/{datawarehouse\_id}/databases/{database\_id}

> Retrieve DataWarehouse database

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/databases/{database_id}":{"get":{"summary":"Retrieve DataWarehouse database","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["data","status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseDatabaseResource"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"description":"","tags":["Data Warehouse"],"operationId":"getDataWarehouseDatabase","parameters":[{"required":true,"in":"path","name":"datawarehouse_id","description":"The data warehouse owning the database","schema":{"type":"string"}},{"description":"The data warehouse database id","in":"path","required":true,"schema":{"type":"string"},"name":"database_id"}]}}},"components":{"schemas":{"DataWarehouseDatabaseResource":{"required":["data_warehouse_id","discovery_date","id","name"],"type":"object","properties":{"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","readOnly":true,"default":0}}},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## PUT /datawarehouses/{datawarehouse\_id}/databases/{database\_id}

> Update a DataWarehouse database

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/databases/{database_id}":{"put":{"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["data","status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseDatabaseResource"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"operationId":"updateDataWarehouseDatabase","parameters":[{"schema":{"type":"string"},"in":"path","required":true,"description":"The data warehouse owning the database","name":"datawarehouse_id"},{"description":"The data warehouse database id","required":true,"in":"path","schema":{"type":"string"},"name":"database_id"}],"requestBody":{"description":"The database to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseDatabaseResource"}}},"required":true},"summary":"Update a DataWarehouse database","description":"","tags":["Data Warehouse"]}}},"components":{"schemas":{"DataWarehouseDatabaseResource":{"required":["data_warehouse_id","discovery_date","id","name"],"type":"object","properties":{"data_warehouse_id":{"type":"string","readOnly":true},"id":{"type":"string","readOnly":true},"name":{"type":"string","readOnly":false},"discovery_date":{"type":"integer","format":"int64","readOnly":true,"default":0}}},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## DELETE /datawarehouses/{datawarehouse\_id}/databases/{database\_id}

> Delete a DataWarehouse database

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/databases/{database_id}":{"delete":{"tags":["Data Warehouse"],"summary":"Delete a DataWarehouse database","parameters":[{"schema":{"type":"string"},"name":"datawarehouse_id","required":true,"in":"path","description":"The data warehouse owning the database"},{"name":"database_id","description":"The data warehouse database id","schema":{"type":"string"},"required":true,"in":"path"}],"operationId":"deleteDataWarehouseDatabase","description":"","responses":{"200":{"description":"Success response","content":{"application/json":{"schema":{"required":["status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}},"components":{"schemas":{"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```

## POST /datawarehouses/{datawarehouse\_id}/credentials

> Register a datawarehouse credentials

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/{datawarehouse_id}/credentials":{"post":{"responses":{"200":{"description":"Success response","content":{"application/json":{"schema":{"required":["status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"operationId":"registerCredentials","summary":"Register a datawarehouse credentials","requestBody":{"description":"The gcp service account to register","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseCredentialsResource"}}},"required":true},"description":"","parameters":[{"required":true,"schema":{"type":"string"},"description":"The data warehouse the credentials give access to","name":"datawarehouse_id","in":"path"}],"tags":["Data Warehouse"]}}},"components":{"schemas":{"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}},"DataWarehouseCredentialsResource":{"required":["credentials","scheme"],"type":"object","properties":{"scheme":{"$ref":"#/components/schemas/TenantCredentialsScheme"},"credentials":{"type":"string","readOnly":false}}},"TenantCredentialsScheme":{"type":"string","readOnly":false,"enum":["GOOGLE_SERVICE_ACCOUNT","NO_CREDENTIALS","JDBC_CREDENTIALS","SNOWFLAKE","HMAC","S3","OAUTH2","API_TOKEN","LOGIN_PASSWORD"]}}}}
```

## POST /datawarehouses/wizard

> Validate and create a DataWarehouse

```json
{"openapi":"3.0.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Data Warehouse","description":"Operations related to Data Warehouse integrations for exporting/importing platform data to/from external data warehouse systems."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/datawarehouses/wizard":{"post":{"requestBody":{"description":"The datamart to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataWarehouseWizardResource"}}},"required":true},"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"required":["data","status"],"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/DataWarehouseResource"}}}}}},"400":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"401":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"403":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"404":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"500":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}},"503":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"tags":["Data Warehouse"],"description":"","operationId":"executeWizard","summary":"Validate and create a DataWarehouse"}}},"components":{"schemas":{"DataWarehouseWizardResource":{"required":["type"],"properties":{"type":{"type":"string","enum":["POSTGRES","BIG_QUERY","SNOWFLAKE"]}},"discriminator":{"propertyName":"type","mapping":{"POSTGRES":"#/components/schemas/Postgres","BIG_QUERY":"#/components/schemas/BigQuery","SNOWFLAKE":"#/components/schemas/Snowflake"}},"oneOf":[{"$ref":"#/components/schemas/Postgres"},{"$ref":"#/components/schemas/BigQuery"},{"$ref":"#/components/schemas/Snowflake"}]},"Postgres":{"required":["credentials","data_warehouse_name","description","organisation_id"],"type":"object","properties":{"description":{"type":"string","readOnly":false},"credentials":{"type":"string","readOnly":false},"working_schema_name":{"type":"string","readOnly":false},"organisation_id":{"type":"string","readOnly":false},"data_warehouse_name":{"type":"string","readOnly":false}}},"BigQuery":{"required":["data_warehouse_name","description","organisation_id","service_account"],"type":"object","properties":{"description":{"type":"string","readOnly":false},"service_account":{"type":"string","readOnly":false},"data_warehouse_name":{"type":"string","readOnly":false},"organisation_id":{"type":"string","readOnly":false},"project_id":{"type":"string","readOnly":false},"working_schema_name":{"type":"string","readOnly":false}}},"Snowflake":{"required":["credentials","data_warehouse_name","description","organisation_id"],"type":"object","properties":{"data_warehouse_name":{"type":"string","readOnly":false},"working_schema_name":{"type":"string","readOnly":false},"description":{"type":"string","readOnly":false},"credentials":{"type":"string","readOnly":false},"organisation_id":{"type":"string","readOnly":false}}},"DataWarehouseResource":{"required":["description","engine_type","id","name","organisation_id"],"type":"object","properties":{"name":{"type":"string","readOnly":false},"description":{"type":"string","readOnly":false},"organisation_id":{"type":"string","readOnly":true},"location":{"type":"string","readOnly":false},"engine_type":{"$ref":"#/components/schemas/DataWarehouseEngineType"},"id":{"type":"string","readOnly":true}}},"DataWarehouseEngineType":{"type":"string","readOnly":false,"enum":["BIG_QUERY","POSTGRES","SNOWFLAKE"]},"errorResponse":{"required":["error","error_code","error_id","status"],"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.mediarithmics.io/api-reference/data-warehouse.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
