Error using export-responses API | XM Community
Skip to main content

Hi all,
I am new to Qualtrics API. I have been able to get myself past obstacles with getting my bearer token for the right scope etc., but this one has me stumped. I am getting the response "Json type body is expected" but the body looks ok to me. I got a successful response using the form on the API documentation and even tried copying the simple body from there and I still get the error. My content type is JSON and Postman obviously thinks it's valid because it's color-coding it properly. If the picture doesn't come through, all I have in the body is:
{
    "format": "csv"
}
What am I missing?
thank you!

image.png

monikaschwartz
Have you included both in your headers? Also getting the export file is a 3 step process as mentioned below:
image.png
Using API to export responses in 3 steps:

  1. Start-response-export

  2. Get-response-export-progress

  3. Get-response-export-file

From the first you will get progress id you need to use in second and in second you will get fileID which you need to add in third.
Hope it helps!


omg, the Content-Type header was set but had become unchecked. It works now. So simple. Thank you!!


monikaschwartz
Glad it worked!
Kindly accept the answer if it worked for you.


Do you know why I would get a 401 with message "invalid_client" on the next steps? I am using the same Bearer token as on the now-functioning initial call to start the export and have put in the progress ID that was returned into the path. I got this to function on the "try it" of the API documentation and got a fileID. The "try it" works for getting the file (although that function is disabled) and I get the same "invalid_client" message trying to do the third step in Postman as I get with the second. It must be something simple again but I'm not sure where to look because the doc doesn't include info for getting a 401 returned.


monikaschwartz
The second step of getting file id uses get method and not post make sure you have changed that.
Also, if you have added the progress id correctly in URL and it would not have any body parameter.
Hope it helps!


Yes, I'm using GET and put the progress id in the URL and no body. Still stumped but thank you!


Never mind, I got it. I had the word "Bearer" in the wrong place. Thanks for all your help!


I’m also getting "errorCode": "QVAL_1", "errorMessage": "Json type request body is expected." in Postman.

I’m using OAUTH2, so there should be one difference from the solution above, but I’m having no luck.

Step 1: Authentication

Note that I’m using scope “manage:all”, but I also tried “read:survey_responses” and I get the same error.

 

Step 2: Request

I select “Bearer” as Authorization with the value from my access token above, using a variable.  I confirmed that the variable value matches the access_token value above.

 

Here’s my Headers.  Please note that Content-Type is set to application/json automatically in the next Body step, and that Authorization is set automatically by the step above.

 

 

Finally, here’s my body.  Please note that I typed this text in, rather than just copying from web page to avoid ASCII character problems that result from copying something that looks like a quote, but is not really a quote.

Also, note that I removed the space after the colon and before “CSV”, as some solutions recommend.

Oddly, I get a successful response when I use the API tester:

 

Please let me know if you can help me!!!!  This is driving me insane and I’m about to smash my laptop because I can’t find anything wrong with my Postman requests.
 


Leave a Reply