Method Community

 

API Filter - How to search for a Company Name that has a single quote in it?

Last post 02-06-2023 2:00 PM by Method_Paul. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-04-2023 1:25 AM

    API Filter - How to search for a Company Name that has a single quote in it?

    I am using the API to search for customer records. Any that have single quotes in their names are erroring in teh API. I have tried encordURI, as well as replacing the single quotes with %27 and keep getting the same error. Any advice on how to search for a name with a single quote? 

    REQUEST:

    https://rest.method.me/api/v1/tables/Entity?filter=Name eq 'Magnolia's%20Best%20Storage'

    RESPONSE: 

    {

    "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
    "title": "Bad Request",
    "status": 400,
    "detail": "Invalid or unsupported query parameter. Error Detail: Syntax error at position 19 in 'Name eq 'Magnolia's Best Storage''.",
    "traceId": "00-143685aec96f5b45968e0c54e79a5f01-3697423975408040-00"
    }
  • 02-06-2023 2:00 PM In reply to

    Re: API Filter - How to search for a Company Name that has a single quote in it?

    Jamie -

    Escaping with a redundant quote will do the trick in escaping the url parameter: (i.e. Magnolia''s not Magnolia's)

    https://rest.method.me/api/v1/tables/Entity?filter=Name eq 'Magnolia''s%20Best%20Storage'

    Paul

Page 1 of 1 (2 items)