Get Data Source (Azure Search Service REST API)

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

Request

HTTPS is required for all services requests. The Get Data Source request can be constructed using the GET method.

GET https://[service name].search.windows.net/datasources/[datasource name]?api-version=[api-version]  
api-key: [admin key]  

The [datasource name] in the request URI specifies which data source definition to return from the datasources collection.

The [api-version] is required. The current version is 2019-05-06. See API versions in Azure Search for details.

Request Headers

The following table describes the required and optional request headers.

Request Header Description
Content-Type: Required. Set this to application/json.
api-key: Required. The api-key is used to authenticate the request to your Search service. It is a string value, unique to your service. The Get Data Source request must include an api-key set to an admin key (as opposed to a query key).

You will also need the service name to construct the request URL. You can get the service name and api-key from your service overview page in the Azure portal. See Create an Azure Search service for details.

Request Body

None.

Response

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

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

Note

The connection string is not returned in the response for security purposes.

{   
    "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" }  
}  

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.

See also

Azure Search Service REST
HTTP status codes (Azure Search)
Indexer operations (Azure Search Service REST API)
Naming rules (Azure Search)
Support for OData (Azure Search)
OData Expression Syntax for Azure Search