Connecting to external API

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
jmacdougall
Posts: 26
Joined: 2015-11-02 01:22

Connecting to external API

Post by jmacdougall » 2020-11-14 14:42

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
Jeff MacDougall

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1814
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Connecting to external API

Post by jsetzer » 2020-11-14 16:38

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.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

jmacdougall
Posts: 26
Joined: 2015-11-02 01:22

Re: Connecting to external API

Post by jmacdougall » 2020-11-20 19:13

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.
Jeff MacDougall


jmacdougall
Posts: 26
Joined: 2015-11-02 01:22

Re: Connecting to external API

Post by jmacdougall » 2020-12-11 03:10

Thank you very much! I will dig in to this!
Jeff MacDougall

Post Reply