Best answer

Pulling data from GraphQL API (Swapcard) with webhook

  • 10 November 2021
  • 4 replies
  • 877 views

Userlevel 1

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!

icon

Best answer by Troy Tessalone 10 November 2021, 21:17

View original

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

Userlevel 7
Badge +14

Hi @JacobMonash 

Try adding double quotes around the value

 

Userlevel 1

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

 

 

Userlevel 7
Badge +14

@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/

Userlevel 1

@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)