Contentful logo

Contentful Community

Possible to escape commas when querying using the `in` operator on the API?

I’ve got a bit of a dilemma. I’m trying to query the content delivery API for my application using the in operator (Content Delivery API | Contentful), but some of the values I want to query on have commas in them.

I know, I know…why do you have IDs with commas. I’m pushing to put a restriction in the content model to not allow this, but currently we have references to these IDs in another DB so getting that updated will take some time. :stuck_out_tongue:

In the meantime, is there any way to escape a comma in the query? E.g., my query parameter on the API looks something like this, 'fields.sku[in]': productTemplateIds.join(','), where productTemplateIds is an array of strings that can have commas in them. I tried URL encoding them, escaping the commas with a \, single quotes around them, and double quotes around them. None of that works. Seems weird they wouldn’t have some way to escape a value that you query on (also, I can’t find anything in their docs about this).

Thanks,
-John