Skip to main content

Import Data Endpoint

Endpoint

POST /api/v1/source/import

This endpoint allows you to send data to the Ayona.ai platform for processing.

Prerequisites

Before you can successfully send data, ensure you meet the following requirements:

  • You have a valid API key (see the authentication section for details).
  • You have configured a REST source in your product. For guidance on how to configure a REST source, refer to the Configuring a REST Source section of the documentation.

Request Payload

You must send the payload in the following format:

Object Model for Import Data Request

The following object model represents the structure of the request payload for the /api/v1/source/import endpoint:

{
"source_id": string,
"payload": [
{
"date": string,
"name": string,
"content": string
}
]
}

Object Model Breakdown

  • source_id:

    • Type: string
    • Description: The unique identifier for the source, as defined in the REST source configuration.
  • payload:

    • Type: Array of Objects
    • Description: An array containing feedback entries.

    Each object in the payload array contains:

    • date:

      • Type: string
      • Description: The date and time of the feedback submission, formatted as "YYYY-MM-DD HH:mm:ss".
    • name:

      • Type: string
      • Description: The name of the user providing feedback.
    • content:

      • Type: string
      • Description: The feedback content provided by the user.
info

The source_id of your source can be found in the REST source configuration on the platform.

Example Request

Here’s an example of how to send a request using curl:

curl -X POST "https://environment_base_url/api/v1/source/import" \
-H "X-API-KEY: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"source_id": "your_id",
"payload": [
{
"date": "2024-03-08 00:29:00",
"name": "User 1",
"content": "Feedback 1"
},
{
"date": "2024-03-08 00:29:00",
"name": "User 2",
"content": "Feedback 2"
}
]
}'

Responses

Success Response

  • Status: 200 OK
    • Body:
      • Type: Object
      • Description: Indicates that the import process has started successfully.
      • Example:
        {
        "message": "REST import started successfully"
        }

Error Responses

  • Status: 500 Internal Server Error

    • Description: An error occurred on the server. Contact support for assistance.
  • Status: 400 Bad Request

    • Description: The request was malformed.
    • Body:
      • Type: Object
      • Example: The error message will provide details on how the request was malformed.