Search code examples
javascriptjsonqualtrics

Correct format of JSON key for Qualtrics Web Service Query


I'm trying to use the Web Service component of a Qualtrics survey to get data from a mailing list based on an answer provided by the person completing. So they would select "Bob Jones" and then the Web Service would look at the mailing list to then populate the email address for Bob Jones.

I'm able to call the mailing list and see results successfully with the API token, however, any time I try to add a query, I get a return of "Unexpected json key provided"

How can I access a specific entry? The format of the returned list follows:

{
  "result": {
    "elements": [
      {
        "id": "abcdefghijk",
        "firstName": "Bob",
        "lastName": "Jones",
        "email": "bobjones@stackoverflow.com",
        "externalDataReference": "Jones, Bob",
        "embeddedData": {
          "PrimaryEmail": "bobjones@stackoverflow.com",
          "DisplayName": "Jones, Bob"
        },
        "language": "null",
        "unsubscribed": false,
        "responseHistory": [],
        "emailHistory": []
      },

I'm attempting to add the query where it says Parameter to Web Service...:

Qualtrics

I greatly apologize if this has been discussed already. I searched through as many questions as I could, and didn't find an answer to this. Hope someone will help!


Solution

  • The API you are trying to use doesn't accept query parameters and you can't use it to get data for a specific contact.

    Whether you can do it at all depends on whether your account has XM Directory or Research Core Contacts. If you have Research Core Contacts, the only way to get data for a specific contact is by contact id. If you have XM Directory you can use the search API. See: https://api.qualtrics.com/api-reference/reference/contacts.json/paths/~1directories~1{directoryId}~1contacts~1search/post