Regarding Customer Information | XM Community
Skip to main content
Solved

Regarding Customer Information

  • July 16, 2020
  • 13 replies
  • 87 views

How can I get customer information based on email only?

Best answer by Appzk

Please try this!

https://api.qualtrics.com/guides/reference/ccpa.json/paths/~1customer-data-requests/post

13 replies

Appzk
QPN Level 5 ●●●●●
Forum|alt.badge.img+34
  • QPN Level 5 ●●●●●
  • Answer
  • July 16, 2020

  • Author
  • July 17, 2020

Hi Team,
I am new to Qualitrics. I am facing issue to call ajax from custom JS. When I tried
https://ca1.qualtrics.com/API/v3
/customer-data-requests
through chrome I am getting following.
{
"meta": {
"httpStatus": "500 - Internal Server Error",
"error": {
"errorMessage": "Internal server error. Please contact Qualtrics support.",
"errorCode": "CDR_4.0",
"instanceId": ""
},
"requestId": "1837655c-b27b-4882-83bf-77f5ede2e8d0",
"notice": "Request proxied. For faster response times, use this host instead: iad1.qualtrics.com"
}
}


  • Author
  • July 17, 2020

Hi Appzk,
Thanks for the quick response.
But I am getting {"meta":{"httpStatus":"400 - Bad Request","error":{"errorMessage":"Json type request body is expected.","errorCode":"QVAL_1"},"requestId":"efbc9460-8742-49dc-a5c9-89297077a12f","notice":"Request proxied. For faster response times, use this host instead: iad1.qualtrics.com"}}
in the above api


  • Author
  • July 17, 2020

Hi Appzk,
After fixing above now i am getting The requested resource doen not exists
{"meta":{"requestId":"f3952f0c-06d7-4dd4-9fcf-48d5f5723493","httpStatus":"500 - Internal Server Error","error":{"errorCode":"CDR_4.0","errorMessage":"Internal server error. Please contact Qualtrics support."}}}
in url https://co1.qualtrics.com/API/v3
/customer-data-requests


Appzk
QPN Level 5 ●●●●●
Forum|alt.badge.img+34
  • QPN Level 5 ●●●●●
  • July 18, 2020

Hi Punit_123 ,

Please check your server you have passed in the API:
image.png


  • Author
  • July 18, 2020

Hi Appzk,
I am passing the same server that I am passing in others api that are working perfect.
But in api /customer-data-requests
I am getting
 "error": {
      "errorCode": "CDR_4.0",
      "errorMessage": "Internal server error. Please contact Qualtrics support."
    } after passing the parameters
{
 "operation": "access",
 "emails": [
  "email ID of particular contact whom want to search"
 ]
}
Because I am guessing the api Customer-data-requests can helps me to find a user based on their email ID.
Really appreciate your effort if you can helps me in this.


  • Author
  • July 21, 2020

Hi Appzk,
Is there any way to get contact first and last name based on entered email in survey?
I have used https://datacenterID.qualtrics.com/API/v3/customer-data-requests
with parameters {
 "operation": "access",
 "emails": [
  "useremail@domain.com"
 ]
}
getting response
{
  "result": {
    "id": "DA_someID"
  },
  "meta": {
    "requestId": "resultID",
    "httpStatus": "202 - Accepted"
  }
}
But unable to get contact information. Could you please suggest a way how to us resultid and requestID to get contact first name and last?


Appzk
QPN Level 5 ●●●●●
Forum|alt.badge.img+34
  • QPN Level 5 ●●●●●
  • July 21, 2020

Yes!
Step 1: Create a web-service to fetch the contact id
https://.com/API/v3/directories//contacts/search
image.pngStep 2: Using the contact id from Ste 1, now grab rest of the information:
https:/.com/API/v3/directories//contacts/${e://Field/C_ID}
image.pngExample above I am fetching other field based on email.


  • Author
  • July 29, 2020

Hi Appzk,
Thanks for the response it helps.
But I am calling web api addOnPageSubmit  and page submitted before the api response set into the embedded field. Is there any way to submit the page after web api response.
Thanks,


Appzk
QPN Level 5 ●●●●●
Forum|alt.badge.img+34
  • QPN Level 5 ●●●●●
  • July 29, 2020

i guess calling web api thru javascript will help you to submit the page after API has worked.


  • Author
  • July 29, 2020

Hi Appzk,
I am calling Web API through Java Script on

addOnPageSubmit 

But in success of API not able to set embedded field But working fine if I set an embedded filed hard code without API on addOnPageSubmit ,


Appzk
QPN Level 5 ●●●●●
Forum|alt.badge.img+34
  • QPN Level 5 ●●●●●
  • July 29, 2020

try this
Qualtrics.SurveyEngine.setEmbeddedData( ,);


  • Author
  • July 29, 2020

Appzk,
Using the same
Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {

var apiResponse = JSON.parse(this.responseText);
var contactInfo = apiResponse.result.elements[0];

firstName = contactInfo.firstName;
lastName = contactInfo.lastName;
Qualtrics.SurveyEngine.setEmbeddedData("ContactFirstName", firstName);
Qualtrics.SurveyEngine.setEmbeddedData("ContactLastName", lastName);
alert(Qualtrics.SurveyEngine.getEmbeddedData("ContactFirstName"));
// Here I am able to get the first name in alert But this field not updating first name in Data & Analysis tab of Survey
}
Api is returning correct response in var apiResponse