API for search Directory error | XM Community
Skip to main content
Solved

API for search Directory error

  • December 7, 2023
  • 16 replies
  • 265 views

Forum|alt.badge.img+4

Hi,

I am trying to use below API to search for records in Directory :

https://api.qualtrics.com/c79e78a949572-search-directory-contacts

When I was trying out in documentation, single field filter works fine, but when I use below code for multiple criteria based on syntax they have provided I am getting an error :

{

"meta": {

"httpStatus": "400 - Bad Request",

"error": {

"errorMessage": "The provided simpleFilter syntax is invalid, please review all components before retrying the request",

"errorCode": "CFH_0.4"

},

 

 

Below is the code that I am using in body:

 

{

"filter": 
{
"conjunction": "and",
"filters": 
[
{"comparison": "eq",
"filterType": "email",
"value": "aa@b.com"},

{"comparison": "eq",
"filterType": "externaldatareference",
"value": "cc@b.com"}

]
}
}

 

What am I doing wrong ?

Best answer by vgayraud

Hi,

I don’t think identity resolution can have an impact on the API call. Maybe check if your deduplication rules didn’t end up emptying embedded datas or creating multiple contacts with the same extRef and email but different 3rd ED, for which the embedded data fields would be empty.

16 replies

vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • 549 replies
  • December 7, 2023

Hi @Neha Tank 

extRef instead of externaldatareference


Forum|alt.badge.img+4
  • Author
  • Level 4 ●●●●
  • 103 replies
  • December 7, 2023

Thanks a lot vgayraud for the prompt support. It worked fine.

I would like to use this API in webservice element in my survey flow. 

The requirement is to pass email and extRef to get couple of attributes from the contact list and store in embedded field in survey. I wasn’t sure how is the body with filter provided in webservice below:

 

 

I tried passing only one filter in Body parameters and clicked on TEST and it was returning only the requestID. How can I obtain other attributes and store in embedded data ?

 

Thanks in advance.


vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • 549 replies
  • December 7, 2023

Something like that, where you would pipe in values for email and extRef from EDs or questions I suppose :

 


Forum|alt.badge.img+4
  • Author
  • Level 4 ●●●●
  • 103 replies
  • December 7, 2023

I did this but then it gave me same error "The provided simpleFilter syntax is invalid, please review all components before retrying the request", 


vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • 549 replies
  • December 7, 2023

true instead of TRUE and check your filter syntax, it’s working fine for me.

 


Forum|alt.badge.img+4
  • Author
  • Level 4 ●●●●
  • 103 replies
  • December 8, 2023

Thanks a ton vgayraud. It worked well.


Forum|alt.badge.img+4
  • Author
  • Level 4 ●●●●
  • 103 replies
  • December 8, 2023

Now instead of hard coded values for email and extRef I want to give embedded field values. Can it still be done through json ? How should i modify the json filter syntax ?


vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • 549 replies
  • December 8, 2023

Absolutely, just can pipe in the values you want, EDs, question answers, panel fields. you can also add piped-in text in the URL or other query parameters. It’ll look like this :

{
"filter": {
"conjunction": "and",
"filters": [
{"comparison": "eq", "filterType": "email", "value": "${e://Field/yourField1"},
{"comparison": "eq", "filterType": "extRef", "value": "${e://Field/yourField2"}]
}
}

 


Forum|alt.badge.img+4
  • Author
  • Level 4 ●●●●
  • 103 replies
  • April 17, 2025

@vgayraud , If you recollect, you had helped me in setting up webservice and it has been working fine for past 1 year. Last 1 week, the web service has not been returning any embedded data value inspite of no change in webservice. Then I tried testing with static dummy Customer email and External reference email to test the web service as shown below:

 it is fetching all data except embedded data as shown below:

 

 

The only change that happened in last 1 week is that in Directory list , so far the identity resolution columns were email and external reference. We added a embedded field to these two fields. Is it causing problem ? If yes, how can I resolve it ?


vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • 549 replies
  • Answer
  • April 17, 2025

Hi,

I don’t think identity resolution can have an impact on the API call. Maybe check if your deduplication rules didn’t end up emptying embedded datas or creating multiple contacts with the same extRef and email but different 3rd ED, for which the embedded data fields would be empty.


Forum|alt.badge.img+4
  • Author
  • Level 4 ●●●●
  • 103 replies
  • April 18, 2025

Thanks ​@vgayraud , for some records there were multiple entries in the directory and so it was picking record with blank values.

Is there any way to use the API to search for a particular list in Directory instead of the entire directory?

Because in the case I shared with you the blank embedded data entry was in another list of the directory.

 


vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • 549 replies
  • April 18, 2025

You can use the inList filter in conjunction with your existing fiilters.

 


pogi
Level 2 ●●
Forum|alt.badge.img+14
  • Level 2 ●●
  • 153 replies
  • April 25, 2025

This is perfect timing. I’m trying to use this endpoint and successfully search my directory; however, when I try to use the “inList” filterType I receive the error: "The provided simpleFilter syntax is invalid, please review all components before retrying the request". 

Here is the body/data of my request:

{
  "filter": {"filterType": "inList", "comparison":true, "mailingListId": "my_mailingListId"}
}

What am I missing? 


Forum|alt.badge.img+4
  • Author
  • Level 4 ●●●●
  • 103 replies
  • April 25, 2025

@pogi , you need to mention your list name in place of my_mailingListId.

You can find it when you open the list, the URL has the ID in the end CG*.

Hope it helps.


pogi
Level 2 ●●
Forum|alt.badge.img+14
  • Level 2 ●●
  • 153 replies
  • April 27, 2025

@pogi , you need to mention your list name in place of my_mailingListId.

You can find it when you open the list, the URL has the ID in the end CG*.

Hope it helps.

Yes. sorry that was a very crude placeholder. I do enter in my Mailing List ID there. For me, my mailing list ID starts with “ML”. 


vgayraud
QPN Level 6 ●●●●●●
Forum|alt.badge.img+58
  • QPN Level 6 ●●●●●●
  • 549 replies
  • April 28, 2025

Hi,

That is a Research Core mailing list ID. As far as I know, there is no search contact API in research core.