---
title: "Retrieve sample data from the data source"
method: POST
path: "/_api/connectors/{connector-name}/sample"
tags: ["Connections"]
---

# Retrieve sample data from the data source

`POST /_api/connectors/{connector-name}/sample`

## Request

- The document declares no server URL.
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/macrometa/apis/macrometa-api-reference/docs/_api/connectors/:connector-name/sample/post.ts> (a function with typed inputs; its response is checked against the schema)

Retrieve sample data from the data source by supplying the connector configuration.
The response includes both the schema and sample data.

## Path parameters

- `connector-name` string, required

## Request body

- ConnectorSampleRequest
  - `type` string: Connector type. source or target.
  - `config` object: Contains the connector configurations. Key-value pairs should be provided to configure the connection to the respective data source or target.

## Response `200`

Successfully retrieved the connnector sample.

- object
  - `error` boolean, required
  - `code` integer
  - `result` ConnectorSample[]
    - `schema` ConnectorSchema: Model to encapsulate properties of a schema from a connector.
      - `name` string: Name of the schema.
      - `attributes` SchemaAttribute[]: Attributes of the schema.
        - `name` string: Name of the attribute.
        - `type` string: Type of the attribute.
    - `data` object[]: Sample records for the connector.

## Other responses

- `400`: Failed due to missing or malformed data. Verify that all parameters are complete.
- `401`: Failed to authenticate the request.
- `404`: Failed to find the connector.

---

[API](https://skmtc.dev/macrometa/apis/macrometa-api-reference.md) - [All operations](https://skmtc.dev/macrometa/apis/macrometa-api-reference/llms.txt) - [OpenAPI document](https://skmtc.dev/macrometa/apis/macrometa-api-reference/revisions/2006b6d7f31d?raw)
