Anyway to scrub a jql fragment?

I’ve got a field where the user puts in a jql fragment. Is there any way for me to convert the labels to the values when available?

I’m looking for 2 cases:

  1. Where the user puts in a project name - ie. project=“My project” - “My project” should be 10001 (the project id).
  2. Where the user puts in a custom field. ie. “Daniel’s field”=“foo” - “Daniel’s field” should be customfield_12333

I found https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jql/#api-rest-api-3-jql-sanitize-post but it’s experimental, only available for admin apps (we’re not) and still lets the labels through if an app has access to the real value.

Any pointers?

Thanks,

/Daniel

Probably best is to scrub it yourself, you can compare the displayNames of the outputs from https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jql/#api-rest-api-3-jql-autocompletedata-post and replace them for #2 and for #1 write a regex that will find the project = or project IN statements and replace the values according to https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jql/#api-rest-api-3-jql-autocompletedata-suggestions-get

From my own experience, getting the regex right is quite tricky