Survey Taking ApI not working | XM Community
Skip to main content

This is typical curl call below but using python  referred the api documentation below 

https://api.qualtrics.com/d0ea23036b269-start-a-new-session

 

code excerpt

import requests
import json


# your data center (for instance, 'co1')
dataCenter = ''
# your API token
apiToken = ''
# your survey ID

surveyId = ''


url = f"https://{dataCenter}.qualtrics.com/API/v3/surveys/{surveyId}/sessions"

headers = {'X-API-TOKEN': apiToken}
payload = {'language': 'EN', "embeddedData": {
    "edKey": "edValue",
    "customerName": "Kyle"
  },
  "recipientId": "MLRP_1234567890",
  "distributionId": "EMD_1234567890"}

response = requests.post(url, headers=headers, params=payload)

if response.status_code == 200:
    sessionId = json.loads(response.text)s'result']t'sessionId']
    print("Session ID:", sessionId)
else:
    print("API request failed with status code", response.status_code)
    print(response.text)
 

 

Getting issue below 

 

{"meta":{"requestId":"","httpStatus":"500 - Internal Server Error","error":{"errorCode":"QHRSI_2.0","errorMessage":"Unable to get http body as json. Response: Internal Server Error"}}}

 

Thanjks for Help and support

Be the first to reply!

Leave a Reply