A Warehouse is a central repository of data collected from one or more Sources. This is what commonly comes to mind when you think about a relational database: structured data that fits into rows and columns.
Using the Segment Public API, you can create, delete, update, list, validate and connect Warehouses.
Connects a Source to a Warehouse.
• When called, this endpoint may generate the Storage Destination Modified
event in the audit trail.
Created
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.warehouses.addConnectionFromSourceToWarehouse('kjU72LCJexvrqL7G4TMHHN', 'rh5BDZp6QDHvXFCkibm1pR')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "status": "CONNECTED"
}
}
Disconnects a Source from a Warehouse.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.warehouses.removeSourceConnectionFromWarehouse('kjU72LCJexvrqL7G4TMHHN', 'rh5BDZp6QDHvXFCkibm1pR')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "status": "SUCCESS"
}
}
Validates input settings against a Warehouse.
• When called, this endpoint may generate the Storage Destination Settings Validation
event in the audit trail.
OK
Resource not found
Validation failure
Too many requests
{- "metadataId": "55d3d3aea3c",
- "settings": {
- "hostname": "address.us-west-2.redshift.amazonaws.com",
- "port": "5439",
- "database": "db",
- "username": "user",
- "password": "test"
}
}
{- "data": {
- "status": "CONNECTED"
}
}
Creates a new Warehouse.
• When called, this endpoint may generate the Storage Destination Created
event in the audit trail.
Created
Resource not found
Validation failure
Too many requests
{- "metadataId": "CCIl4HLQPz",
- "settings": { }
}
{- "data": {
- "warehouse": {
- "id": "sYpBdHf9aHd7sXEuExZisp",
- "workspaceId": "9aQ1Lj62S4bomZKLF4DPqW",
- "enabled": true,
- "metadata": {
- "id": "CCIl4HLQPz",
- "slug": "snowflake",
- "name": "Snowflake",
- "description": "Data warehouse built for the cloud",
- "logos": {
- "alt": ""
}, - "options": [ ]
}, - "settings": {
- "name": "Snowflake"
}
}
}
}
Returns a list of Warehouses.
object (PaginationInput) Defines the pagination parameters. This parameter exists in v1. Example: pagination=pagination.count=3 |
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.warehouses.listWarehouses()) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "warehouses": [
- {
- "id": "kjU72LCJexvrqL7G4TMHHN",
- "workspaceId": "9aQ1Lj62S4bomZKLF4DPqW",
- "enabled": true,
- "metadata": {
- "id": "55d3d3aea3c",
- "slug": "postgres",
- "name": "Postgres",
- "description": "Open source data warehouse",
- "logos": {
- "mark": "",
- "alt": ""
}, - "options": [
- {
- "name": "port",
- "required": true,
- "type": "string"
}, - {
- "name": "database",
- "required": true,
- "type": "string"
}, - {
- "name": "hostname",
- "required": true,
- "type": "string"
}, - {
- "name": "password",
- "required": true,
- "type": "string"
}, - {
- "name": "username",
- "required": true,
- "type": "string"
}, - {
- "name": "ciphertext",
- "required": true,
- "type": "string"
}
]
}, - "settings": { }
}, - {
- "id": "v1e6FCE8P9EvQmCLWpKtJ3",
- "workspaceId": "9aQ1Lj62S4bomZKLF4DPqW",
- "enabled": true,
- "metadata": {
- "id": "aea3c55dsz",
- "slug": "redshift",
- "name": "Redshift",
- "description": "Powered by Amazon Web Services",
- "logos": {
- "mark": "",
- "alt": ""
}, - "options": [
- {
- "name": "port",
- "required": true,
- "type": "string"
}, - {
- "name": "database",
- "required": true,
- "type": "string"
}, - {
- "name": "hostname",
- "required": true,
- "type": "string"
}, - {
- "name": "password",
- "required": true,
- "type": "string"
}, - {
- "name": "username",
- "required": true,
- "type": "string"
}, - {
- "name": "ciphertext",
- "required": true,
- "type": "string"
}
]
}, - "settings": { }
}
], - "pagination": {
- "current": "MA==",
- "totalEntries": 2
}
}
}
Deletes an existing Warehouse.
• When called, this endpoint may generate the Storage Destination Deleted
event in the audit trail.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.warehouses.deleteWarehouse('tmiTtiPi58udvDAjcxKUJY')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "status": "SUCCESS"
}
}
Returns a Warehouse by its id.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.warehouses.getWarehouse('kjU72LCJexvrqL7G4TMHHN')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "warehouse": {
- "id": "kjU72LCJexvrqL7G4TMHHN",
- "workspaceId": "9aQ1Lj62S4bomZKLF4DPqW",
- "enabled": true,
- "metadata": {
- "id": "55d3d3aea3c",
- "slug": "postgres",
- "name": "Postgres",
- "description": "Open source data warehouse",
- "logos": {
- "mark": "",
- "alt": ""
}, - "options": [
- {
- "name": "port",
- "required": true,
- "type": "string"
}, - {
- "name": "database",
- "required": true,
- "type": "string"
}, - {
- "name": "hostname",
- "required": true,
- "type": "string"
}, - {
- "name": "password",
- "required": true,
- "type": "string"
}, - {
- "name": "username",
- "required": true,
- "type": "string"
}, - {
- "name": "ciphertext",
- "required": true,
- "type": "string"
}
]
}, - "settings": { }
}
}
}
Updates an existing Warehouse.
• When called, this endpoint may generate one or more of the following audit trail events:* Storage Destination Modified
OK
Resource not found
Validation failure
Too many requests
{- "name": "Redshift Dev",
- "settings": { }
}
{- "data": {
- "warehouse": {
- "id": "kjU72LCJexvrqL7G4TMHHN",
- "workspaceId": "9aQ1Lj62S4bomZKLF4DPqW",
- "enabled": true,
- "metadata": {
- "id": "55d3d3aea3c",
- "slug": "postgres",
- "name": "Postgres",
- "description": "Open source data warehouse",
- "logos": {
- "mark": "",
- "alt": ""
}, - "options": [
- {
- "name": "port",
- "required": true,
- "type": "string"
}, - {
- "name": "database",
- "required": true,
- "type": "string"
}, - {
- "name": "hostname",
- "required": true,
- "type": "string"
}, - {
- "name": "password",
- "required": true,
- "type": "string"
}, - {
- "name": "username",
- "required": true,
- "type": "string"
}, - {
- "name": "ciphertext",
- "required": true,
- "type": "string"
}
]
}, - "settings": {
- "name": "Redshift Dev"
}
}
}
}
Verifies the state of Warehouse connection settings.
The rate limit for this endpoint is 200 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See Rate Limiting for more information.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.warehouses.getConnectionStateFromWarehouse('kjU72LCJexvrqL7G4TMHHN')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "connectionState": "CONNECTED"
}
}
Returns the list of Sources that are connected to a Warehouse.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.warehouses.listConnectedSourcesFromWarehouse('kjU72LCJexvrqL7G4TMHHN')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "sources": [
- {
- "id": "qQEHquLrjRDN9j1ByrChyn",
- "slug": "swift",
- "name": "",
- "workspaceId": "9aQ1Lj62S4bomZKLF4DPqW",
- "enabled": true,
- "writeKeys": [
- "bEj5MzDqCkHYRqreZgbPuH"
], - "metadata": {
- "id": "dZeHygTSD4",
- "slug": "swift",
- "name": "Apple",
- "categories": [
- "Mobile"
], - "description": "The hassle-free way to add Segment analytics to your swift app (iOS, macOS, tvOS).",
- "logos": {
}, - "options": [ ],
- "isCloudEventSource": false
}, - "settings": { },
- "labels": [ ]
}
], - "pagination": {
- "current": "MA==",
- "totalEntries": 1
}
}
}