I've been on and off on Fusio but have gotten some time to get back to it now and restarted from scratch with the latest Fusio v4.
Regarding my post about the HTTP Processor it seems in fact that it won't be possible to do it the way i thought.
So the solution would be to build a PHP Sandbox or Processor action.
So here's what I'm trying while using a simple GET api:
The API I'm targeting is working, I'm getting the expected result, while simply using the browser or postman.
The API requires as parameters an API key, which will is variable, and the method I'm using simply lists a table of countries.
So in Fusio what I did was to create an action and it's corresponding operation/route to call this API.
The endpoint that is responding correctly, and that I want to call in Fusio, as the following url:
What i want to call in my App, pointing to Fusio, has action with access, table and action predefined, and I'd like it to look like this:
I'm using PHP Sandbox for the moment as I'm still trying to connect VS to Fusio, so here's my code:
<?php
use Fusio\Action;
use Fusio\Request;
use Fusio\Response;
function execute(Request $request, Response $response)
{
$params = $request->getArguments();
$osclassApiKey = $params["apikey"];
$osClassApiUrl = $params["apiurl"];
// Build my request
$request = Fusio\Request::create($osclassApiKey);
$request->setMethod("GET");
$request->setQuery([
"key" => $osclassApiKey,
"access" => "read",
"table" => "country",
"action" => "listAll",
]);
// Call the endpoint API using Service class
$service = Fusio\Service::get($osclassApiUrl);
$response = $service->call($request);
return $response;
}
This looks something it should work but the problem is I'm getting a 204 status, and an empty response of course.
What should I be doing differently and any suggestion on why I'm getting an empty response ?