Get Data Source (Azure AI Search REST API)

Important

This API reference is for a legacy version. See Data plane REST operations for updated reference documentation. Use the filter on the top left to select a version.

The Get Data Source operation gets the data source definition from Azure AI Search.

GET https://[service name].search.windows.net/datasources/[data source name]?api-version=[api-version]&includeConnectionString=[includeConnectionString]
  Content-Type: application/json  
  api-key: [admin key]  

URI Parameters

Parameter Description
service name Required. Set this to the unique, user-defined name of your search service.
data source name Required. The request URI specifies the name of the data source to return.
api-version Required. The current stable version is api-version=2020-06-30. See API versions for more versions.
includeConnectionString Optional. The default is false (connection string is omitted from the response). When set to true, the response includes the connection string, minus the user name and password, if they exist.

Request Headers

The following table describes the required and optional request headers.

Fields Description
Content-Type Required. Set this to application/json
api-key Optional if you're using Azure roles and a bearer token is provided on the request, otherwise a key is required. An api-key is a unique, system-generated string that authenticates the request to your search service. Get requests for an object definition must include an api-key field set to your admin key (as opposed to a query key). See Connect to Azure AI Search using key authentication for details.

Request Body

None.

Response

Status Code: 200 OK is returned for a successful response.

The response body is similar to examples in Create Data Source (Azure AI Search REST API).

Note

By default, the connection string is not returned in the response. If the URI parameter includeConnectionString is set to true, a connection string trimmed of the user name and password is returned in the response.

{
    "name" : "asqldatasource",  
    "description" : "a description",  
    "type" : "azuresql",  
    "credentials" : { "connectionString" : null },  
    "container" : { "name" : "sometable" },  
    "dataChangeDetectionPolicy" : {
        "@odata.type" : "#Microsoft.Azure.Search.HighWaterMarkChangeDetectionPolicy",  
        "highWaterMarkColumnName" : "RowVersion" },
    "dataDeletionDetectionPolicy" : {
        "@odata.type" : "#Microsoft.Azure.Search.SoftDeleteColumnDeletionDetectionPolicy",  
        "softDeleteColumnName" : "IsDeleted",
        "softDeleteMarkerValue" : "true" },
    "encryptionKey": null
}  

Note

Do not set the Accept request header to application/json;odata.metadata=none when calling this API as doing so will cause @odata.type attribute to be omitted from the response and you won't be able to differentiate between data change and data deletion detection policies of different types.

Note

If the data source has an encryption key, the search service must have access to the encryption key to retrieve the data source definition. Without access to the encryption key, a 400 Bad Request is returned. Restoring access to the key allows the search service to retrieve the data source definition again.

See also