contentful.py icon indicating copy to clipboard operation
contentful.py copied to clipboard

Incorrect documentation for Search parameters

Open sortafreel opened this issue 2 years ago • 0 comments

I need to filter entries by Content Type and fields existence. So, the expected code, that API documentation suggests is:

client.entries({'content_type': '<content_type_id>', 'fields.tags[exists]': True})

or, if real-life example:

client.entries(query={"content_type": "surveyTemplate", "fields.survey_id[exists]": True})

But the query doesn't work, because [exists] part is being ignored. To make it work, you need to change True to "true", which is a bit unexpected. So, the code needs to look like this:

client.entries(query={"content_type": "surveyTemplate", "fields.survey_id[exists]": "true"})

I assume, that's not the only example of incorrect bool to text conversion, but one of the easiest ones to check. So, I suggest either to fix the documentation to mirror the actually expected input, or fixing the library to make bool values work.

sortafreel avatar May 18 '22 18:05 sortafreel