Posts Tagged ‘azure cognitive services’

Try to delete from Azure cognitive search and receive a “not valid parameter”

July 8th, 2024

Say you try to delete from Azure search / Azure cognitive services / something-ai-copilot like so:


1
2
3
4
5
6
7
8
9
10
11
12
13
<em>### DELETE</em>
POST {{url}}/indexes/user-index-2021-03-25/docs/search?api-version=2023-07-01-preview
Content-Type: application/json
api-key: {{apiKey}}

{
    "value": &#91;
        {
            "@search.action": "delete",
            "rid": "RHZaaF9vbG05R1hH"
        }
    ]
}

Ang get a response like:


1
2
3
4
5
6
{
  "error": {
    "code": "",
    "message": "The request is invalid. Details: The parameter 'value' in the request payload is not a valid parameter for the operation 'search'."
  }
}

Then the problem is probably the “search” in the URL.

Try “index” instead:


1
POST {{url}}/indexes/user-index-2021-03-25/docs/index?api-version=2023-07-01-preview