Update synonym map (Azure Cognitive Search REST API)

Request

You can update an existing synonym map using an HTTP PUT request. You specify the name of the synonym map to update on the request URI:

PUT https://[service name].search.windows.net/synonymmaps/[synonymmap name]?api-version=[api-version]  
Content-Type: application/json  
api-key: [admin key]  

The api-version is required. The current version is 2019-05-06. See API versions in Azure Cognitive 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 Update Synonym Map request must include an api-key header set to your 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 dashboard in the Azure portal. See Create an Azure Cognitive Search service in the portal for page navigation help.

Request Body

The request body syntax is the same as for Create Synonym Map (Azure Cognitive Search REST API).

Response

For a successful request, "201 Created" if a new synonym map was created, and "204 No Content" if an existing synonym map was updated

By default the response body will be empty. However, if the Prefer request header is set to return=representation, the response body will contain the JSON for the synonym map that was updated or created. In this case, the success status code will be "201 Created" if a new synonym map was created and "200 OK" if an existing synonym map was updated.

See also

Azure Cognitive Search REST APIs
HTTP status codes (Azure Cognitive Search)
Synonym map operations (Azure Cognitive Search REST API)
Naming rules (Azure Cognitive Search)