I have been trying to get my head around webhooks and have hit a problem I can’t solve, I am hopeful it is something straight forward. I have a URL which returns json data with the endpoints configuring the returned values.
The page for the API is here:http://api.population.io
It seems the request parameters for the url call ups are not typical key / value pairs. I am a little lost as to how to customise the url with data from my photon so that it returns what I need.
In my example I would like the user to set their age with the photon and have that added into the URL end point.
Here is the complete url that gets the right data into the browser:
Apologies for not being able to express myself with the right terminology, but I hope someone can give a pointer as to whether this is possible with webhooks.
I’m not completely sure what you’re asking, but you can set part of the request URL to be data sent from the Photon. The way it works is that you format the event data as JSON. Then, you use mustache template variables in your webhook definition for the URL. This allows you to insert data generated from your Photon into the URL.
Using the mustache variables is described here:
Thanks for your quick reply, so I should have the start point of the url e.g.
and then have the rest of the data sent as json. Would I put that json into “send custom data” with “json” checked in the web console.
I have looked at your tutorials, could you point me to where you do this in there. Apologies for being lost with this.
You want to define your URL as something like this:
and then your publish would look like this:
ahha, that makes sense, I shall try that now. Thanks for your reply and your posts online about webhooks.
It worked like a charm, wow it has finally clicked how brilliant webhooks are, much appreciated.
Awesome! Mind editing your title and adding a
[SOLVED] to the front?