How to fetch data from an API

Hey guys

Im new to API so bear we with me.

Im trying get data from a api website which outputs in JSON format. I dont know where to start haha. what functions do i use to fetch data from the website and display it over serial.

Thanks

You could use a webhook:

https://docs.particle.io/guide/tools-and-features/webhooks/

1 Like

Will this let me call a GET function?

Yes.

ok thanks, ill look into this… is there a piece code that someone has written to call a GET funciton?? sorry completely new to this kinda stuff

With or without using a webhook?

any?

Let’s do it with a webhook.

What API do you want to get data from?

1 Like

my work has this company API. currently im calling the urls using Postman.

Ok, no problem.

Can you make a webhook from within the Particle Console?

https://console.particle.io/integrations

1 Like

i just wana call this url with the photon. https://example.sada/api/sda/recipe?api_token=blahblahla

Try making a webhook like this:

1 Like

ok ill give it a shot, thanks

image

It doesnt post anything on console

Maybe you could reduce the delay?

1 Like

OMG thanks dude!

1 Like

is there a different way to to trigger the integration?

i want to store that data into a string so i can use the info. Thanks

Do you want the photon to get the full JSON or just certain part(s)?

1 Like