How to create Blocks with Qualtrics API | XM Community
Skip to main content
Solved

How to create Blocks with Qualtrics API

  • October 20, 2023
  • 3 replies
  • 348 views

Forum|alt.badge.img+1

Hello everyone (:

 

I’m trying to create blocks with the Qualtrics API but I can’t get it to work. This is my API Call:

baseUrl = "https://{0}.qualtrics.com/API/v3/survey-definitions/{1}/blocks".format(
        data_center_id, survey_id)
headers = {
"x-api-token": api_token
}
block_def ={
        "Type": "Standard",
        "Description": "block",
        "ID": f”{block_id}",
    }
response = requests.post(baseUrl, json=block_def, headers=headers)
 
And this is the response:
 
{ "meta": { "requestId": "3e02c72d-8518-4244-9e4e-0ff2f9b41be9", "httpStatus": "400 - Bad Request", "error": { "errorCode": "QMST_1", "errorMessage": "The request was invalid.", "code": "ESRV35", "message": "Invalid request. Missing or invalid parameter ID." } } }
 
I really can’t wrap my head around what’s going wrong here, I figured all the other API calls out that I had to make. Possibly I’m using the wrong block_id? I figured I’d have to make up a new one here right?
 
Cheers!
mo

Best answer by mo.rice

actually it worked after I deleted the ID part as well (:

 

can be marked as solved

 

 
 

 

 

3 replies

Nam Nguyen
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+29
  • QPN Level 8 ●●●●●●●●
  • October 20, 2023

@mo.rice You’re missing alot of required field in the body

 


Forum|alt.badge.img+1
  • Author
  • Answer
  • October 20, 2023

actually it worked after I deleted the ID part as well (:

 

can be marked as solved

 

 
 

 

 


Nam Nguyen
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+29
  • QPN Level 8 ●●●●●●●●
  • October 21, 2023

actually it worked after I deleted the ID part as well (:

can be marked as solved

@mo.rice Haha, in the document they require a bunch of field but then it work without them 🤣