How do I send a POST Request to Sharepoint | XM Community
Solved

How do I send a POST Request to Sharepoint

  • 15 June 2020
  • 3 replies
  • 200 views

Hey all,

I'm trying to create an Action following a survey being submitted that sends a POST web service request to an internal SharePoint site. I've already configured a bearer token and whatnot. The problem I'm running into is that in *Postman* I can just construct the body (JSON ) to be the following:
{ "Title": "Some random title"}
and it will post fine to the list. When I come over to Qualtrics and use the same two headers for accept and content-type I get lost at the body. I pass in "Title" = "Some random title" (which then Qualtrics removes the quotes) but then on survey completion, the item is never pushed to the SP list. Is there something I'm missing? I've also tested this with https://reqbin.com/ and it posts fine so clearly I must not be putting the right body in this request for qualtrics.

icon

Best answer by pauchamb 16 June 2020, 19:23

View original

3 replies

Userlevel 7
Badge +27

Did you add it as data like this?
image.png

Hey Tom,
Thanks for reaching out so quickly! What I ended up doing was calling a web service request inside the actual survey flow. With that, I was able to pass in a Query Parameter of {Accept: application/json;odata=verbose} and that seemed to do the trick. Additionally, I passed the {Authorization: Bearer [token]} in the Custom Headers portion. The advantageous part of including this in the survey flow rather than as an Action is that I was then able to save the returned data (specifically the date/time created) and add that as embedded data to show if/when the successful POST went through.
The only limitation of this was that I couldn't pass the answers directly into the keys but instead had to save the answers in embedded data variables and pass those into the keys as values.

https://www.qualtrics.com/community/discussion/comment/26757#Comment_26757Appreciate you taking the time to respond again! I'm sure this won't be our last encounter! 😂

Leave a Reply