For some reason I cannot get a “delete-participants” API call to work in my extension.
I can make other calls work, so it is not the connection or authentication. I keep on getting a 500 (internal server error), unless if I deliberately configure the body as a string instead of an array, then I get a 400 error.
I have tried all possible and impossible options to format the body, but a no point have I been successful in getting this to work from the extension. It is not a problem to get this to work from Postman, but running it from the extension just does not work.
This is the simplified code (with project ID hidden):
module.exports = async function(context) {
let getDeleteParticipants;
try {
const requestOptionsDelete = {
method: "POST",
body: S"DisableTestID"],
};
getDeleteParticipants = await context.client.qualtricsApiFetch('ex-projects/TS_……./delete-participants', requestOptionsDelete);
if (error.status === 201){
return {
message: 'Job completed without any errors.',
getDeleteParticipants: getDeleteParticipants,
errorStatus: error.status
};
} else {
return {
message: 'Job failed.',
getDeleteParticipants: getDeleteParticipants,
errorStatus: error.status
};
}
} catch (error){
return {
message: 'Error happened.',
getDeleteParticipants: getDeleteParticipants,
errorStatus: error.status
};
}
};
And this is the output:
{ "actionId": "OCAC_ITu8fegq6eeSfFI", "exports": { "getDeleteParticipants": { "responseData": { "error": { "errorCode": "DPG_0.0", "errorMessage": "An unexpected error occurred." }, "meta": { "httpStatusCode": 500, "requestId": "1798ee66-73eb-48db-8e9e-899b24702d6e" } }, "status": 500 }, "message": "Error happened." }}
Can anyone make this work?