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

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": 
b
{"comparison": "eq",
"filterType": "email",
"value": "[email protected]"},

{"comparison": "eq",
"filterType": "externaldatareference",
"value": "[email protected]"}

]
}
}

 

What am I doing wrong ?

Hi @Neha Tank 

extRef instead of externaldatareference


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.


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

 


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


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

 


Thanks a ton vgayraud. It worked well.


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 ?


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"}]
}
}

 


@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 ?


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.


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.

 


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

 


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? 


@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 , 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”. 


Hi,

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


Leave a Reply


OSZAR »