Fusio

Posted on Updated on

After playing with the Fusio project for a while, and trying it out in probably the most unorthodox way, and trying to read between the lines with the documentation, I’ve managed to get a list of data from the php_sandbox.

For example, this is the php code:

<?php
$connection = $connector->getConnection('System');

$id = (int)$request->getParameters('user_id');
$another_string =  $request->getParameters('another_string');
$todo = $connection->fetchAll('Select *, date as datecol from fusio_app where user_id = ' . $id . ' order by datecol ASC');
$count  = $connection->fetchColumn('SELECT COUNT(*) FROM fusio_app where user_id = ' . $id );

return $response->build(200, [], 
[
    'another_string' => $another_string,
    'totalResults' => $count,
    'results' => $todo
    ]);

URI Fragments:

user_id=1&another_string=Steve

Method:

GET

 

HTTP example GET:
 https://domain.com/fusio/public/index.php/get_test?user_id=1

And, that should then give you a response of the “apps” currently listed in the main database, if this is a fresh install.

Response:

{
    "another_string": {
        "user_id": "1",
        "another_string": "Steve"
    },
    "totalResults": "3",
    "results": [
        {
            "id": "3",
            "user_id": "1",
            "status": "1",
            "name": "YSG",
            "url": "",
            "parameters": null,
            "app_key": "xxxxxxxxxxxxxxxxxx",
            "app_secret": "xxxxxxxxxxxxxxxxxx",
            "date": "2019-03-24 14:22:36",
            "datecol": "2019-03-24 14:22:36"
        },
        {
            "id": "1",
            "user_id": "1",
            "status": "1",
            "name": "Backend",
            "url": "http://fusio-project.org",
            "parameters": "",
            "app_key": "xxxxxxxxxxxxxxxxxx",
            "app_secret": "xxxxxxxxxxxxxxxxxx",
            "date": "2019-03-24 22:08:13",
            "datecol": "2019-03-24 22:08:13"
        },
        {
            "id": "2",
            "user_id": "1",
            "status": "1",
            "name": "Consumer",
            "url": "http://fusio-project.org",
            "parameters": "",
            "app_key": "xxxxxxxxxxxxxxxxxx",
            "app_secret": "xxxxxxxxxxxxxxxxxx",
            "date": "2019-03-24 22:08:13",
            "datecol": "2019-03-24 22:08:13"
        }
    ]
}

Of course this is just a test, and should be accompanied with better security policies and the like, with a token response or similar, but it’s a general quick request.

There is so much more room for better documentation on the site, as most what is currently written, is that it assumed you know the majority of it already.

I’ll post more and update more as I continue to discover things.

This documentation has a few examples:
https://www.fusio-project.org/documentation/recipes/select-rows

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s