Question

Failed to create HTTP request to Sharepoint; 'Domain did not expected domain filter'

  • 3 August 2023
  • 6 replies
  • 192 views

Running into an issue creating a custom API request Action when interacting with Sharepoint. I’m trying to use the Microsoft Graph API to create a new list item in Sharepoint when a new form is submitted to our website.

I’ve tried my request using Microsoft Graph Explorer and can confirm that my request body is valid. I suspect the issue is something with the authentication but Zapier does not expose the true error. Instead I get this generic ‘Domain did not match expected domain filter’. I’ve double checked that my domain is accurate. Has anyone gotten the API request Action to work with Sharepoint?

 

 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +14

Hi @stsalyuk 

Good question.

Try setting the specified headers, such as Content-Type: application/json

Hi Troy - thanks for the quick response. After adding the content-type and accept headers I’m getting the same error. I’m curious as to how Zapier does the authentication for this action. Microsoft is notoriously difficult to get the right access token for. Is there a way I can expose a more meaningful error message through Zapier? Is Zapier even executing the request or is the domain filter error implying that my request doesn’t even get made?

Userlevel 7
Badge +14

@stsalyuk 

What is the link to the SharePoint API docs that you are referencing?

I’ve seen other topics that have the same error across apps, so I’m guessing it’s related to Zapier, but that could be because of the data being input into the request for the app that Zapier then runs behind the scenes.


 

@Troy Tessalone here is what I’m trying to follow:

https://learn.microsoft.com/en-us/graph/api/listitem-create?view=graph-rest-1.0&tabs=http

Using MS Graph Explorer, I can validate that my request goes through. However, Graph Explorer takes care of the token for me. In my Zap, Zapier is allegedly doing the same but I suspect this isn’t happening as expected or perhaps the scopes on the token aren’t set properly.

I’ve also tried this approach:

https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/working-with-lists-and-list-items-with-rest#create-list-item

Thanks for your help!

Userlevel 7
Badge +14

@stsalyuk 

Try only setting 1 additional Header for Content-Type: application/json

 

This did not work for me @Troy Tessalone. Appreciate your help.

I ultimately ended up going with a different approach. Instead of using the Sharepoint API request Action, I used a Code By Zapier action. This allowed me to split the requests whereby I had control of the authentication. Once I got the Microsoft Graph Auth token, I was able to use it to call the Microsoft Graph API programmatically using Javascript to create my list item.