How to filter by title containing apostrophes using the Jira Align REST API 2 GET
Summary
Trying to use the Jira Align REST API 2 to get a capability (or other work item) containing an apostrophe in the title, it fails with a syntax error such as:
Cannot find capabilities. Syntax error at position X in 'title eq 'title_with_apostrophe''
Environment
Jira Align
Solution
In order to successfully use the filter function from a GET call (and avoid the syntax error), you should place a single quote in front of the apostrophe to escape it (in other words, having two single quotes consecutively).
As a result, if you have a title such as: 'It’s a test', you need to use the filter criteria: 'It''s a test'
Here is an example:
https://<site-host>/rest/align/api/2/capabilities?$filter=title%20eq%20%27it%27%27s%20a%20test%27 |
---|
or
https://<site-host>/rest/align/api/2/capabilities?$filter=title eq 'It''s a test' |