Page 1 of 1

Connecting to external API

Posted: 2020-11-14 14:42
by jmacdougall
I would like to connect to some of my external vendor websites to bring in dynamic data to my proposed AG application. I do not see anything documented in the forums about it. Is this possible with AG? Thanks! :D

Re: Connecting to external API

Posted: 2020-11-14 16:38
by jsetzer
Sure, nowadays many services do provide their data in JSON format.

As a consumer you can fetch data from remote services using PHP or Javascript.

Just a simple example in PHP:

Code: Select all

// php
$response = file_get_contents("https://your-data-service-provider.com/api/v2/your_request.php?arg1=123");
$data = json_decode($response);
// process $data
// ...
But beware, for a productive system there is still a lot to consider, for example security and authentication (tokens), versioning of data schemes and validation, received data and error-handling.

Re: Connecting to external API

Posted: 2020-11-20 19:13
by jmacdougall
Thank you for the response. I do see on my various vendor websites where I create the tokens and shared keys. I guess my next step would be, how do I setup field on the AG side to populate with data from GET commands. Forgive me for being an absolute novice here. I just don't know ehere to start.

Re: Connecting to external API

Posted: 2020-12-11 02:57
by sathukorala

Re: Connecting to external API

Posted: 2020-12-11 03:10
by jmacdougall
Thank you very much! I will dig in to this!