ANY operator with an array of values

How to get data that equals to one of the list/array?
I have this expression in the param value:

[{ "field_id": "c56de34d-1e25-4284-b665", "operator":"ANY": "0","2","6"]}]

I get this error:
all custom field filters must have an operator",“ECODE”:"ITEM_158

Please advise,
Thank you

Hi @aahhpp. Welcome to the Postman Community.

This question isn’t clear enough. What are you trying to achieve within Postman? Can you share screenshots showing what you’re trying to do while providing more context/explanation. Are you getting this error on the Postman console or in the APU response body?

Thanks @gbadebo-bello ,
I want to get ANY of the following values: 0/2/6 where I highlighted in this image[it works]:

Please advise,
Thank you

Okay. You want to access the data in your query parameters.

Why are you adding an array in a query parameter? Does the API specify that you do that? An array looks like something that should go into the request body instead. Can you check the documentation to confirm that you’re doing this the correct way?

1 Like

Thanks @gbadebo-bello ,
unfortunately the API documentation does not specify it:(
There is a list of operators. ANY is one of them:

That is not valid JSON with the colon after the “ANY” value. Which is then causing the whole “operator” key to be invalid.

This is the example from the documentation pretty printed.

[
    {
        "field_id": "de761538-8ae0-42e8-91d9-f1a0cdfbd8b5",
        "operator": ">",
        "value": 2
    }
]

What I can’t tell from the documentation is what the value will accept.

Whether it needs to be an array, an object, or something else.

I would have thought that ANY, would be a wildcard operator (same meaning as *), so it would be a single value.

There is a TIP on that page which details how to find the acceptable values for a particular field_id.

You also might need to discuss this with the supplier as this is really specific to that API, rather than Postman specific.

1 Like

Thanks @michaelderekjones ,
the “>” wouldn’t really do the trick here because I need specific values, not only < than 2…
Any other ideas?
Thank you!

You change the operator to be one of the supported values detailed in the documentation.

I guess in your instance it would be “ANY”.

But as mentioned, I don’t know what the value for ANY will accept as its not specifically covered in the document. As as starter for ten you can try an array.

[
    {
        "field_id": "de761538-8ae0-42e8-91d9-f1a0cdfbd8b5",
        "operator": "ANY",
        "value": [
            "0",
            "2",
            "6"
        ]
    }
]

If this doesn’t work, you may need to confirm with the supplier of the API.

1 Like

thanks @michaelderekjones ,
it did not work:(
is there a way to achieve this if we paste it in the request body instead of the params?

No, as the documentation says it has to be a query parameter.

Did the latest attempt produce a different error message?

If it doesn’t work, then I can only recommend contacting the supplier of the API to confirm the format of the value when the operator is “ANY”.

The documentation does not have an example, so any recommendation is a guess. We tried an array and it didn’t work. Therefore, I can only advise to contact the supplier.

How do you even know that the “ANY” type can take more than one value. It still reads like it should be a wildcard value.

1 Like

Hi @michaelderekjones ,
Would you know why I get an error when I try to have each value as in one line in the params? when running with one at a time works fine…
ex: custom_filed=[{ “field_id”: “de761538-8ae0-42e8-91d9-f1a0cdfbd8b5”,
“operator”: “=”,
“value”:
“0”}]

Sorry, no I don’t. (You also haven’t explained what the new error is).

The questions you are posing are about the correct structure for the request, and is related specifically to this API.

As the documentation doesn’t give examples for the various operators, I can only recommend again that you raise this with the suppliers support.

Most of the other operators are obvious, but they didn’t provide an example for “ANY”.

Looking at the documentation, you can only have one custom_fields parameter.

That custom query can have more than one object in it. For example…

[
    {
        "field_id": "de761538-8ae0-42e8-91d9-f1a0cdfbd8b5",
        "operator": "=",
        "value": "0"
    },
    {
        "field_id": "de761538-8ae0-42e8-91d9-f1a0cdfbd8b5",
        "operator": "=",
        "value": "2"
    },
    {
        "field_id": "de761538-8ae0-42e8-91d9-f1a0cdfbd8b5",
        "operator": "=",
        "value": "6"
    }
]

Thanks @michaelderekjones,
I tried the above. getting this error:
“err”: “custom fields must be a json parsable string”,

Ok, looking at the documentation again…

Lastly the {...} at the end represents any additional Custom Fields we want to filter by.

You might not be able to do what I suggested.

Which means we are back to speaking to the supplier.

1 Like

Thanks @michaelderekjones !
Just got a reply from ClickUp. Seems to be a bug…
This should have worked:
[https://api.clickup.com/api/v2/team/8610747/task?custom_field=[{](https://api.clickup.com/api/v2/team/8610747/task?custom_field=[{)“field_id”:“3f90d2ee-34e3-43ce-9f98-37dd560fc4ed”.“operator”:ANY",“value”:2},{"value":4}]

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.