Getting started
Back to home
Getting started

Read table columns

Read column names, types and key information for a PostgreSQL table.

GET/api/customer/v1/projects/{projectId}/databases/{databaseId}/tables/{table}/schema

Path parameters

NameValue
projectIdRequired resource ID from an earlier API response.
databaseIdRequired resource ID from an earlier API response.
tableRequired table.

Query parameters

NameTypeRequiredLimits
schemastringNoSee schema

Example request

Set HCODE_BASE_URL and HCODE_API_KEY as shown in Getting started. Replace resource variables with your own IDs.

curl --request GET "$HCODE_BASE_URL/api/customer/v1/projects/${PROJECT_ID}/databases/${DATABASE_ID}/tables/${TABLE}/schema" \
  --header "Authorization: Bearer $HCODE_API_KEY"

Response

The JSON shape is defined in the response schema.

Response schema
{
  "type": "object",
  "properties": {
    "columns": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "nullable": {
            "type": "boolean"
          },
          "defaultValue": {}
        },
        "required": [],
        "additionalProperties": true
      }
    }
  },
  "required": [],
  "additionalProperties": true
}

See errors and retries for failure responses.