Error Message about inactive Survey during Create Distribution API call | XM Community
Question

Error Message about inactive Survey during Create Distribution API call

  • 18 November 2020
  • 0 replies
  • 26 views

We have a created a survey and a mailling list. When we select the mailling list to create Personal Links via web-based Qualtrics platform (i.e. i.e. https://www.qualtrics.com/support/survey-platform/distributions-module/email-distribution/personal-links/ ), it worked perfectly.

But when we tried to use the Create Distribution API (i.e. https://api.qualtrics.com/api-reference/reference/distributions.json/paths/~1distributions/post ) to generate the list of personal links, we ran into unexpected error message saying the survey is not active.
Error message in response
{"meta":{"httpStatus":"400 - Bad Request","error":{"errorMessage":"Issue with parameter: surveyId, please fix and try again. Reason: Inactive survey specified.","errorCode":"CD_400_1"},"requestId":"4*******-****-****-****-**masked***b"}}
We wonder if we missed anything. (Note that we are using Research Core Contacts as we do not have XM Directory.)

Below is the related code we are using:
String qid = "SV_d****masked***j";
String qmid = "ML_8****masked***L";
String API_TOKEN = "y**************masked******************g"; 
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\\"surveyId\\":\\"" + qid + "\\""
                                  + ", \\"linkType\\":\\"Individual\\" "
                                  + ", \\"description\\":\\"distribution\\" "
                                  + ", \\"action\\":\\"CreateDistribution\\" "
                                  + ", \\"expirationDate\\":\\"2021-01-31 00:00:00\\" "
                                  + ", \\"mailingListId\\":\\"" + qmid + "\\" "
                                  + "}");
Request request = new Request.Builder()
                       .url("https://****.au1.qualtrics.com/API/v3/distributions")
                       .post(body)
                       .addHeader("x-api-token", API_TOKEN)
                       .build();
 
Response response = client.newCall(request).execute();
               String responseString = response.body().string();
out.println(responseString + "

");

Can anyone help to shed some lights on this issues? 😥


0 replies

Be the first to reply!

Leave a Reply