Hi All,
I'm trying to use the PROJ/search API endpoint to find projects that meet the following criteria:
(status is not CPL AND status is not DED AND enteredByID = 111) OR (status is not CPL AND status is not DED AND enteredByID = 222)
I know that the API takes the filters in a text mode like manner, so here's my attempt for the 1st part (line breaks added here only for easier reading):
PROJ/search?$$LIMIT=2000&fields=ID,name,status,enteredBy:name
&status=CPL
&status_Mod=ne
&AND:1:status=DED
&AND:1:status_Mod=ne
&enteredByID=111
How would I add the 2nd part of the filters?
I'm trying this:
PROJ/search?$$LIMIT=2000&fields=ID,name,status,enteredBy:name
&status=CPL
&status_Mod=ne
&AND:1:status=DED
&AND:1:status_Mod=ne
&enteredByID=111
&OR:1:status=CPL
&OR:1:status_Mod=ne
&OR:1:AND:2:status=DED
&OR:1:AND:2:status_Mod=ne
&OR:1:enteredByID=222
But it gives me an error response:
422 Unprocessable Entity - APIModel V19_0 does not support field AND (Project)
I appreciate if anyone can share any idea.
Cheers,
Tibor
토픽은 커뮤니티 콘텐츠를 분류하여 관련성 있는 콘텐츠를 찾는 데 도움이 됩니다.
조회 수
답글
좋아요 수
Hi @tibormolnar,
We had a similar logic implemented some time ago.
Some of the things to consider before we dive into solution
This is example logic for query string and how it should be formatted (also including DATA extension fields)
{"qs":[
{"key":"fields", "value":"ID,project:name,opTask:name,DE:calc field,currentVersion:ext"},
{"key":"AND:1:DE:calc field", "value":"DESIRED_FIELD_VALUE"},
{"key":"AND:2:OR:1:DE:calc expiration date_Mod", "value":"gt"},
{"key":"AND:2:OR:1:DE:calc expiration date", "value":"{{now}}"},
{"key":"AND:2:OR:2:DE:calc expiration date_Mod", "value":"isblank"},
{"key":"$$LIMIT", "value":"ADD_IF_NEEDED"},
{"key":"$$FIRST", "value":"ADD_IF_NEEDED"}
]}
Hopefully this helps. Please let me know if you have any additional questions.
Best regards,
Ivan Bebek
조회 수
답글
좋아요 수
I haven't tested it myself, but please give this a try. I have updated status_Mod to "notin"
PROJ/search?$$LIMIT=2000&fields=ID,name,status,enteredBy:name
&status=CPL
&status_Mod=notin
&status=DED
&status_Mod=notin
&enteredByID=111
&OR:1:status=CPL
&OR:1:status_Mod=notin
&OR:1:status=DED
&OR:1:status_Mod=notin
&OR:1:enteredByID=222
조회 수
답글
좋아요 수
Hi @IvanBebek-iX , @_Manish_Singh, thank you both for the ideas.
I guess I need to refine my question a little bit:
I'm actually looking for the syntax to implement this logic in a query string: (... AND ....) OR ( ... AND ... )
Ivan, is that something that only the internal API version supports?
Thank you,
Tibor
조회 수
답글
좋아요 수
Hi @tibormolnar,
The example that I have sent is a working example (with a twist that I have used imaginary fields but you get the gist).
Example from above checks if the custom field has desired value and one of the two date greater than now or date not set.
Regarding the supported API version as far as I remember using internal API is mandatory if you want to do this, at least it was when we did it, but from the initial information that you have provided above I would say is still the case.
Best regards,
Ivan
조회 수
답글
좋아요 수