> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentcloud.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Test A Datasource To Be Added

> Test a new datasource. This is required to gather the datasource schema, tables and values to continue to the next stage of addition. This MUST be executed first when adding a new datasource



## OpenAPI

````yaml post /{resourceSlug}/forms/datasource/test
openapi: 3.0.0
info:
  title: Agentcloud Webapp API Docs
  description: The API docs for Agentcloud's webapp.
  version: 0.2.1
servers:
  - url: https://app.agentcloud.dev
    description: Use our public api endpoints!
  - url: '{custom_url}'
    description: Test the endpoints on your own instance of Agent Cloud!
    variables:
      custom_url:
        default: https://app.agentcloud.dev
security: []
tags: []
paths:
  /{resourceSlug}/forms/datasource/test:
    post:
      tags:
        - Datasources
      summary: Test A Datasource To Be Added
      description: >-
        Test a new datasource. This is required to gather the datasource schema,
        tables and values to continue to the next stage of addition. This MUST
        be executed first when adding a new datasource
      operationId: testDatasourceApi
      parameters:
        - name: resourceSlug
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/ObjectId'
          description: >-
            The resourceSlug is a url parameter of the teamId associated with
            the user. Anywhere the resourceSlug is used can be interpreted as a
            teamId
      requestBody:
        required: true
        content:
          req.json:
            schema:
              $ref: '#/components/schemas/TestDatasourceJSONBody'
      responses:
        '200':
          description: >-
            Successfully tested the datasource and validated it's configuration
            for Airbyte, can now move onto the addDatasourceApi route
          content:
            dynamicResponse:
              schema:
                type: object
                allOf:
                  - $ref: '#/components/schemas/dynamicResponse'
                  - properties:
                      discoveredSchema:
                        type: object
                        description: >-
                          This return is mainly used for front end operations of
                          Agent Cloud, it is an Airbyte object found here:
                          'https://airbyte-public-api-docs.s3.us-east-2.amazonaws.com/rapidoc-api-docs.html#post-/v1/sources/discover_schema'
                      streamProperties:
                        type: object
                        description: >-
                          This is an Airbyte object used to describe the stream
                          between the datasource and Agent Cloud, it holds the
                          properties of it, more information can be found on the
                          Airbyte Reference here:
                          'https://reference.airbyte.com/reference/getstreamproperties'
                      sourceId:
                        type: string
                        description: >-
                          When Airbyte creates the new source it creates a
                          unique UUID for it for within Airbyte, this UUID is
                          returned form Airbyte and also returned from this API
                          call.
        '400':
          description: >-
            Error when testing validity of datasource, check the error message
            to see specifically what validation failed.
          content:
            dynamicResponse:
              schema:
                $ref: '#/components/schemas/dynamicResponse'
        '403':
          description: Invalid Permissions on the resourceSlug.
          content:
            dynamicResponse:
              schema:
                $ref: '#/components/schemas/dynamicResponse'
        '500':
          description: Internal error
          content:
            dynamicResponse:
              schema:
                $ref: '#/components/schemas/dynamicResponse'
components:
  schemas:
    ObjectId:
      description: >-
        Mongodb Object id, unique identifier, length of 24 characters fitting
        the following regex; [a-f0-9]{24}
      type: string
    TestDatasourceJSONBody:
      properties:
        connectorId:
          type: string
          description: >-
            The type of datasource being pulled from, the full list of supported
            sources and their corresponding in JSON format can be found at:
            'https://connectors.airbyte.com/files/generated_reports/connector_registry_report.json'.
            One of these connectors must be selected as the type of datasource
            to pull from. Insert the Id of the connector in this field
        datasourceName:
          type: string
          description: >-
            Arbitary name for the datasource, this doesn't need to follow any
            specific convention, can simply be any name to identify it.
        datasourceDescription:
          type: string
          description: >-
            Description for the datasource, this is used when fetching the
            datasources on 'datasourcesJson' to briefly describe what each
            datasource is from/contains.
        sourceConfig:
          description: >-
            sourceConfig is defined by Airbyte to determine the config required
            to set up the datasource with Airbyte. See the docs at:
            'https://reference.airbyte.com/reference/createsource' for more
            information. See the 'configuration' body params and find the source
            that you are using.
        timeUnit:
          type: string
          description: >-
            Used to indicate howoften the datasource is synced, this syncing is
            to ensure the data within Agent Cloud is synchronised with the data
            within the datasource. This is the period between each
            synchronisation. The specific number of each period is set later in
            the addition process (i.e. when using addDatasourceApi).
          enum:
            - minute
            - hour
            - day
            - week
            - month
      description: >-
        Task object to be added with at minimum all required fields, _id must be
        ommited, this will be generated by the api and returned upon successful
        completion.
    dynamicResponse:
      description: Server response
      properties:
        message:
          type: string
          description: Error message to provide more detail
        code:
          type: integer
          description: the error code

````