Get Columns
This endpoint allows you get column information for your database(s).
POST Parameters
| Parameter | Required | Value | Description |
|---|---|---|---|
api_key | {key} | An API key that has access to the resource you want to query for | |
database_id | {integer} | The ID of a database you want to get the column information for | |
column_id | {integer} | The ID of the column you wish to get details for | |
column_name | {string} | The name of the column you want information for | |
group_id | {integer} | Used in conjunction with the column_name parameter to limit results |
Important Requirements:
- One of database_id, column_id, or column_name must be provided (⚠️ indicates at least one is required)
- If any of these parameters conflict, no result will be returned
- group_id is only used with column_name parameter to limit results
Code Examples
The cURL, PHP, Python, Node.js, and C# examples call Xtracta from a trusted server. The React example calls an application-defined backend proxy so the API key is never exposed in browser code.
Store XTRACTA_API_KEY as a server-side environment variable. Never embed it in browser-delivered code.
curl --request POST 'https://api-app.xtracta.com/v1/databases/columns' \ --header 'Accept: application/json' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'api_key=<API_KEY>' \ --data-urlencode 'database_id=<DATABASE_ID>'
Sample Request
POST https://api-app.xtracta.com/v1/databases/columns HTTP/1.1 api_key=123&database_id=12345
Sample Response
<?xml version="1.0" encoding="UTF-8"?>
<databases_response>
<status>200</status>
<message>The request has been successfully processed</message>
<column>
<id>8123</id>
<name>Supplier name</name>
<database_id>456789</database_id>
<group_id>3</group_id>
</column>
<column>
<id>8124</id>
<name>Supplier code</name>
<database_id>456789</database_id>
<group_id>3</group_id>
</column>
</databases_response>
Schema Definition
Response Elements
| Element | Description |
|---|---|
<status> | A status code in response to the operation. |
<message> | Additional information about the operation – human readable. |
<column> | A containing tag for the sub-elements containing the actual information about each column. There can be multiple columns within each set of this tag. |
<column>→<id> | The ID of the column |
<column>→<name> | The name of the column |
<column>→<database_id> | The database ID the column belongs to |
<column>→<group_id> | The group ID the column belongs to |
Example
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:simpleType name="ConfidenceType">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value=""/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
<xs:complexType name="ColumnType">
<xs:sequence>
<xs:element name="id" type="xs:positiveInteger"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="database_id" type="xs:integer"/>
<xs:element name="group_id" type="xs:positiveInteger"/>
</xs:sequence>
</xs:complexType>
<xs:element name="databases_response">
<xs:complexType>
<xs:sequence>
<xs:element name="status" type="xs:positiveInteger"/>
<xs:element name="message" type="xs:string"/>
<xs:element name="column" type="ColumnType" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Error Responses
For JSON and XML responses generated by this endpoint, the response is wrapped in databases_response and includes the HTTP status code and a message.
| Status | Message | Description |
|---|---|---|
400 | database_id must be natural number / column_id must be natural number | Use positive integer IDs when filtering. |
404 | No column found | Check the database or column selector and API-key access. |
500 | Internal server error occurred. Please try again later or contact support@xtracta.com | Retry and contact support with the request parameters and timestamp if it persists. |
Authentication, permission, IP-access-control, and rate-limit failures can be returned before this endpoint processes the request. Confirm the API key and caller access first.