Web Service Task to external platform failing authorization | XM Community
Question

Web Service Task to external platform failing authorization

  • 3 March 2021
  • 0 replies
  • 38 views

Badge

Hey folks!
I'm setting up an external Web Service Task via survey Actions but I'm hitting a wall. The external API I'm posting to (Smartsheet) requires a token. I have put the token in the web request using the "Auth" dropdown field as instructed by the Qualtrics documentation. The response I get from Smartsheet is "403 - You are not authorized to perform this action."
To test that I was understanding the request correctly, I tried the request using Python's request module and succeeded. Here's the code for that (sensitive info redacted):
url = 'https://api.smartsheet.com/2.0/sheets/[sheetId]/rows'
headers = {
    "Authorization": "Bearer [API token]",
    "Content-Type": "application/json"
}
json = {
    "parentId": 3982896953616260,
    "cells": [
        {
            "columnId": 6892958455752580,         
            "value": "some value"
        }
    ]
}
response = requests.post(url=url, json=json, headers=headers)
Also, the Web Service Task does succeed if I put the API token in the headers of the task (see screenshot):
SS API Web Service.png
I suppose I could just leave the token in the headers like that, but I'm not super keen on the token sitting very visibly in the headers. Is there a better way I could be using the "Auth" dropdown or Qualtrics' requests?
Any help appreciated!


0 replies

Be the first to reply!

Leave a Reply