Skip to main content
Best answer

Pulling data from GraphQL API (Swapcard) with webhook

  • November 9, 2021
  • 4 replies
  • 1166 views

JacobMonash

I’m trying to build a custom request webhook to retrieve data from Swapcard’s GraphQL API.

Unfortunately, I’m not great with coding, but seem to know just enough to get myself into trouble!

Hoping someone who knows a bit more about API encoding can help me out.

 

So, I’ve successfully tested out Swapcard’s suggested “first call”.

Here’s their suggestion:

 

And here’s what I put into the custom request webhook - which successfully returned a result:

 

Now I’m trying to build out another of their examples - getting Event information by event id

 

Here’s their example:

When I try to put that into Zapier, it doesn’t work - here’s what I put:

 

When I try this, it says

“The app returned "Argument "id" has invalid value RXZlbnRfMTkyOTgw.".

 

Further confusing me, when I build the request in their GraphQL Explorer, the query works:

 

Which makes me think I’m just formatting the Custom Request wrong in some way. Maybe something about non-nullable values??

 

Would really appreciate any help!

Best answer by Troy TessaloneBest answer by Troy Tessalone

@JacobMonash 

Best to copy/paste then edit as much of the code as possible from the API docs.

You may have to refer to the API docs for help on better understanding the error codes.

Also you may want to try building and testing the API request in Postman: https://www.postman.com/

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Troy Tessalone
Forum|alt.badge.img+14
  • Zapier Expert
  • 30948 replies
  • November 10, 2021

Hi @JacobMonash 

Try adding double quotes around the value

 


JacobMonash
  • Author
  • Beginner
  • 2 replies
  • November 10, 2021

@Troy Tessalone thanks I tried double quotes, but Zapier is returning an error :confused:

 

 


Troy Tessalone
Forum|alt.badge.img+14
  • Zapier Expert
  • 30948 replies
  • Answer
  • November 10, 2021

@JacobMonash 

Best to copy/paste then edit as much of the code as possible from the API docs.

You may have to refer to the API docs for help on better understanding the error codes.

Also you may want to try building and testing the API request in Postman: https://www.postman.com/


JacobMonash
  • Author
  • Beginner
  • 2 replies
  • November 10, 2021

@Troy Tessalone thanks for the recommendation re: Postman!

If anyone else runs into this, I copied the example code from the Swapcard api docs, tested the request in Postman, and when I saw that was successful, I copied a portion of the code snippet (in HTTP format) that Postman generated for me into the Zapier webook “Data” field:

(so basically, Postman helped format the request in a way that Zapier liked)