How to create Blocks with Qualtrics API | XM Community
Solved

How to create Blocks with Qualtrics API

  • 20 October 2023
  • 3 replies
  • 173 views

Badge +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
icon

Best answer by mo.rice 20 October 2023, 23:21

View original

3 replies

Userlevel 7
Badge +20

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

 

Badge +1

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

 

can be marked as solved

 

 
 

 

 

Userlevel 7
Badge +20

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 🤣

Leave a Reply