0

I am using the userentitlement REST API in Azure DevOps and when using the filter parameter with a single quoted string as a value , I get the error . Here is my request

https://vsaex.dev.azure.com/{Myorganization}/_apis/userentitlements?$filter=name+eq+'Gary D'Jessi'&api-version=5.1-preview.3

This is the response I get

{
"$id": "1",
"innerException": null,
"message": "Invalid filter: \"name eq 'Gary D'Jessi'\"",
"typeName": "Microsoft.VisualStudio.Services.WebApi.Exceptions.InvalidQueryStringException, Microsoft.VisualStudio.Services.WebApi",
"typeKey": "InvalidQueryStringException",
"errorCode": 0,
"eventId": 3000

}

I tried using the solution with https://stackoverflow.com/a/4483742/7841330 but did not help.

Joe_12345
  • 589
  • 2
  • 7
  • 19
  • As you said, you tried a solution from other SO question. Can you provide your request with `''` and the response, please? – Vlad DX Dec 29 '22 at 21:12

1 Answers1

1

The correct way to escape is to place two single quotes into the string instead one.

For example name+eq+'Gary D''Jessi'

I tested in postman and it worked fine. RESULT

Hope it can help you.

Dou Xu-MSFT
  • 880
  • 1
  • 1
  • 4