### Install Fusio Backend App Source: https://github.com/apioo/fusio-docs/blob/main/docs/ecosystem/framework.md Installs the Fusio backend application from the marketplace. ```bash php bin/fusio marketplace:install fusio ``` -------------------------------- ### Install Stripe Adapter Source: https://github.com/apioo/fusio-docs/blob/main/docs/monetization.md Install the Stripe adapter using Composer and register it with Fusio. ```bash composer require fusio/adapter-stripe php bin/fusio system:register "Fusio\Adapter\Stripe\Adapter" ``` -------------------------------- ### Install Dependencies Source: https://github.com/apioo/fusio-docs/blob/main/docs/ecosystem/framework.md Installs the required dependencies for the Fusio framework project. ```bash composer install ``` -------------------------------- ### File Directory GetAll Response Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/file-directory-getall.md This is an example of the JSON response when retrieving files from a directory. It includes total results, items per page, start index, and a list of file entries. ```json { "totalResults": 1, "itemsPerPage": 16, "startIndex": 0, "entry": [ { "id": "e13fe597-537e-36c2-b99a-d652c3021a36", "fileName": "test_semicolon.csv", "size": 19, "contentType": "text\/plain", "sha1": "759c145ff96ed97db41dfa923a0a9fa71f058dbe", "lastModified": "0000-00-00T00:00:00+00:00" } ] } ``` -------------------------------- ### Execute SQL Query with Worker Java Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/worker-java.md This example demonstrates how to fetch data from a SQL database using the Worker-Java. It shows how to establish a database connection, construct a SQL query with optional filtering, execute the query, and format the results. Ensure the 'App' connection is configured in your Fusio setup. ```java import org.fusioproject.worker.runtime.generated.ExecuteRequest; import org.fusioproject.worker.runtime.generated.ExecuteContext; import org.fusioproject.worker.runtime.Connector; import org.fusioproject.worker.runtime.ResponseBuilder; import org.fusioproject.worker.runtime.Dispatcher; import org.fusioproject.worker.runtime.Logger; def handle(ExecuteRequest request, ExecuteContext context, Connector connector, ResponseBuilder response, Dispatcher dispatcher, Logger logger) { def connection = connector.getConnection("App"); def filter = request.getArguments().get("filter"); def query = "SELECT id, title, content, insert_date FROM my_blog"; if (filter) { query += " WHERE title LIKE ?" } def entries = []; try (def ps = connection.prepareStatement(query)) { if (filter) { ps.setString(1, "%" + filter + "%"); } def rs = ps.executeQuery(); while (rs.next()) { entries.add([ id: rs.getInt("id"), name: rs.getString("title"), description: rs.getString("content"), insertDate: rs.getString("insert_date") ]); } } return response.build(200, [:], [ entries: entries ]); } ``` -------------------------------- ### File Directory Get Response Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/file-directory-get.md This is an example of the response structure when the File Directory Get action successfully retrieves and parses a file. The content is returned as an array of arrays, representing rows and columns. ```json { "fileName": "test_semicolon.csv", "content": [ [ "id", "name" ], [ "1", "foo" ], [ "2", "bar" ] ] } ``` -------------------------------- ### Install ReDoc App Source: https://github.com/apioo/fusio-docs/blob/main/docs/developer_portal/redoc.md Installs the ReDoc app via the Fusio marketplace command-line interface. This app is used to render the OpenAPI specification. ```bash php bin/fusio marketplace:install redoc ``` -------------------------------- ### Install or Update Apps via CLI Source: https://github.com/apioo/fusio-docs/blob/main/docs/marketplace.md These commands allow you to install or update specific apps from the Fusio Marketplace using their name via the command-line interface. ```bash php bin/fusio marketplace:install app [app_name] ``` ```bash php bin/fusio marketplace:update app [app_name] ``` -------------------------------- ### Install Fusio Cronjob Command Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/cronjob.md Setup a single cronjob that invokes the Fusio command every minute. Ensure the user invoking the command has the same environment variables and rights as the www-data user. ```bash * * * * * bin/fusio cronjob > /tmp/cronjob.log 2>&1 ``` -------------------------------- ### Database Migration Source: https://github.com/apioo/fusio-docs/blob/main/docs/ecosystem/framework.md Installs the Fusio and app tables in the provided database. ```bash php bin/fusio migrate ``` -------------------------------- ### Install Fusio Schema Migrations Source: https://github.com/apioo/fusio-docs/blob/main/docs/development/migration.md Execute this command to install Fusio's internal schema and apply any pending migrations to the database configured in your .env file. ```bash php /bin/fusio migration:migrate ``` -------------------------------- ### Example Custom Action - HelloWorld Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/index.md This is an example of a custom action class that extends Fusio\Engine\ActionAbstract. It demonstrates how to implement the handle method to return a simple JSON response. Dependencies can be injected via the constructor. ```php response->build(200, [], [ 'hello' => 'world' ]); } } ``` -------------------------------- ### GraphQL Response Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/protocol/graphql.md Example of a successful response from a GraphQL query. ```json { "data": { "testListFoo": { "entry": [ { "title": "bar" } ] } } } ``` -------------------------------- ### Redis Hash Get Response Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/redis-hash-get.md This is an example of the JSON response returned by the Redis Hash Get action when a value is successfully retrieved. ```json { "value": "foobar" } ``` -------------------------------- ### Install Fusio Plant Source: https://github.com/apioo/fusio-docs/blob/main/docs/ecosystem/plant.md Execute this script as root to install Fusio Plant on a fresh Ubuntu server. Ensure your domain's DNS A/AAAA record points to your server before running. ```bash curl -s https://raw.githubusercontent.com/apioo/fusio-plant/refs/heads/main/install.sh -o ./install.sh && chmod +x ./install.sh && ./install.sh ``` -------------------------------- ### Start MCP Server with STDIO Transport Source: https://github.com/apioo/fusio-docs/blob/main/docs/protocol/mcp.md Run this command to start the MCP server using the STDIO transport. All operations are exposed by default. ```bash php bin/fusio mcp ``` -------------------------------- ### PHP Sandbox Action Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/php-sandbox.md This example demonstrates how to access and return request data, URI fragments, and payload within the PHP Sandbox action. It shows how to retrieve parameters from the request and build a response. ```php get('id'); // returns a path or query parameter $payload = $request->getPayload(); // returns the request payload $arguments = $request->getArguments(); // returns all available arguments as array // returns a configured connection, in case of a SQL connection this returns a doctrine DBAL instance which you could // now use to query the database //$connection = $connector->getConnection('mysql'); return $response->build(200, [], [ 'id' => $id, 'uriFragments' => $arguments, 'payload' => $payload, ]); ``` -------------------------------- ### Redis Hash GetAll Response Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/redis-hash-getall.md This is an example of the JSON response when using the Redis Hash GetAll action. It shows the structure of the returned hash values. ```json { "values": { "key": "foobar" } } ``` -------------------------------- ### PHP Processor Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/php-processor.md This example demonstrates how to fetch data from a database using Doctrine DBAL and return it as a JSON response. It requires a database connection named 'App'. ```php getConnection('App'); $count = $connection->fetchColumn('SELECT COUNT(*) FROM my_table'); $result = $connection->fetchAll('SELECT * FROM my_table ORDER BY sort DESC'); return $response->build(200, [], [ 'totalCount' => $count, 'entries' => $result, ]); ``` -------------------------------- ### Multiple Operations Response Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/protocol/graphql.md Example of a response when invoking multiple GraphQL operations. ```json { "data": { "testListFoo": { "entry": [ { "title": "bar" } ] }, "completeList": { "entry": [ { "content": "foo" }, { "content": "bar" } ] } } } ``` -------------------------------- ### PHP File Action Implementation Source: https://github.com/apioo/fusio-docs/blob/main/docs/development/deployment_system.md Example of a PHP file that Fusio includes directly. It has access to various engine interfaces and services. ```php build(200, [], [ 'message' => 'Hello World!', ]); ``` -------------------------------- ### Configure Global Middleware in Fusio Source: https://github.com/apioo/fusio-docs/blob/main/docs/internal/middleware.md Example of configuring global middleware in `configuration.php` to add a custom header to every response. ```php 'psx_filter_pre' => [function($request, $response, $filterChain){ // add a custom header $response->setHeader('X-Foo', 'bar'); $filterChain->handle($request, $response); }], 'psx_filter_post' => [ ], ``` -------------------------------- ### Implement Event Listener Source: https://github.com/apioo/fusio-docs/blob/main/docs/internal/event.md Implement the `EventSubscriberInterface` and define subscribed events in `getSubscribedEvents`. This example shows how to listen for the `Action\CreatedEvent`. ```php namespace App\EventListener; use Fusio\Impl\Event; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class MyListener implements EventSubscriberInterface { public function onActionCreate(Event\Action\CreatedEvent $event): void { // @TODO execute your custom logic } public static function getSubscribedEvents(): array { return [ Event\Action\CreatedEvent::class => 'onActionCreate', ]; } } ``` -------------------------------- ### Custom Connection Implementation Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/connection/index.md Implement the `ConnectionInterface` to create a custom connection. This example shows how to define the connection name, retrieve configuration parameters, and configure the connection form. ```php get('username'), $config->get('password'), ); } public function configure(BuilderInterface $builder, ElementFactoryInterface $elementFactory): void { $builder->add($elementFactory->newInput('username', 'Username', 'text', 'The name of the service user')); $builder->add($elementFactory->newInput('password', 'Password', 'password', 'The password of the service service user')); } } ``` -------------------------------- ### Basic Action Implementation Source: https://github.com/apioo/fusio-docs/blob/main/docs/action/index.md This is a basic example of a Fusio action implementing the Engine\ActionInterface. It receives a request and returns a simple JSON response. ```php 'world' ]; } } ``` -------------------------------- ### Start MCP Server with Specific User ID (STDIO) Source: https://github.com/apioo/fusio-docs/blob/main/docs/protocol/mcp.md To expose only specific tools via the STDIO transport, provide a user ID as an argument. ```bash php bin/fusio mcp [user_id] ``` -------------------------------- ### Redis Hash Set Response Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/redis-hash-set.md This is an example of the response body when the Redis Hash Set action is successful. It indicates the success status, a message, and the number of fields set. ```json { "success": true, "message": "Field successfully set", "return": 1 } ``` -------------------------------- ### SQL Builder JQL Output Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/sql-builder.md This is the JSON output generated by the SQL builder JQL example. It shows the structure and data for total entries and a list of entries with nested author details. ```json { "totalEntries": 2, "entries": [ { "id": 1, "title": "foo", "tags": [ "foo", "bar" ], "author": { "displayName": "Foo Bar", "uri": "http:\/\/phpsx.org" } }, { "id": 2, "title": "bar", "tags": [ "foo", "bar" ], "author": { "displayName": "Foo Bar", "uri": "http:\/\/phpsx.org" } } ] } ``` -------------------------------- ### PHP Class Action Implementation Source: https://github.com/apioo/fusio-docs/blob/main/docs/development/deployment_system.md Example of a PHP class that can be automatically autoloaded by Fusio. It must implement Fusio\Engine\ActionInterface. ```php response->build(200, [], [ 'message' => 'Hello World!', ]); } } ``` -------------------------------- ### Custom Action with Internal API Usage Source: https://github.com/apioo/fusio-docs/blob/main/docs/development/custom_action.md An example demonstrating the use of internal action APIs for database connections, event dispatching, and logging within a custom action. ```php connector->getConnection('My_Connection'); $this->dispatcher->dispatch('my_event', ['foo' => 'bar']); $this->logger->info('A log message'); return $this->response->build(200, [], [ 'hello' => 'world' ]); } } ``` -------------------------------- ### Redis Hash GetAll Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/redis-hash-getall.md Returns all fields for the configured key. You should bind this action to a route i.e. `GET /values`. ```APIDOC ## GET /values ### Description Returns all fields for the configured Redis hash key. ### Method GET ### Endpoint /values ### Response #### Success Response (200) - **values** (object) - An object containing all fields and their values from the Redis hash. #### Response Example ```json { "values": { "key": "foobar" } } ``` ``` -------------------------------- ### SQL Query Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/sql-query-row.md This SQL query demonstrates joining two tables and filtering by a parameter. Parameters are enclosed in curly brackets and are safely handled by prepared statements. ```sql SELECT * FROM contract INNER JOIN product ON contract.product_id = product.id WHERE product.id = {id} ``` -------------------------------- ### SQL Builder JQL Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/sql-builder.md This JQL defines how to fetch total entries and individual entries with nested author information from SQL tables. It includes parameter binding and data definition for the output structure. ```json { "totalEntries": { "$value": "SELECT COUNT(*) AS cnt FROM psx_sql_provider_news", "$definition": { "$key": "cnt", "$field": "integer" } }, "entries": { "$collection": "SELECT id, authorId, title, createDate FROM psx_sql_provider_news WHERE status = :status ORDER BY id ASC LIMIT :startIndex, 8", "$params": { "status": { "$context": "status", "$default": 1 }, "startIndex": 0 }, "$definition": { "id": { "$key": "id", "$field": "integer" }, "title": "title", "tags": { "$column": "SELECT title FROM psx_sql_provider_news", "$definition": "title" }, "author": { "$entity": "SELECT id, name, uri FROM psx_sql_provider_author WHERE id = :id", "$params": { "id": { "$ref": "authorId" } }, "$definition": { "displayName": "name", "uri": "uri" } } } } } ``` -------------------------------- ### Github Identity Provider Implementation Source: https://github.com/apioo/fusio-docs/blob/main/docs/internal/social_login.md Example implementation of a custom identity provider for Github. This class extends `ProviderAbstract` and implements the `configure`, `getAuthorizationUri`, `getTokenUri`, `getUserInfoUri`, and `getNameProperty` methods. ```php add($elementFactory->newInput('client_id', 'Client-ID', 'text', 'Client-ID')); $builder->add($elementFactory->newInput('client_secret', 'Client-Secret', 'text', 'Client-Secret')); } public function getAuthorizationUri(): ?string { return 'https://github.com/login/oauth/authorize'; } public function getTokenUri(): ?string { return 'https://github.com/login/oauth/access_token'; } public function getUserInfoUri(): ?string { return 'https://api.github.com/user'; } public function getNameProperty(): string { return 'login'; } } ``` -------------------------------- ### Dockerfile for Fusio Project Source: https://github.com/apioo/fusio-docs/blob/main/docs/development/docker_image.md This Dockerfile copies your project's resources, source code, configuration, and dependencies into the base Fusio image. It then sets correct ownership and installs composer dependencies. ```Dockerfile FROM fusio/fusio COPY ./resources /var/www/html/fusio/resources COPY ./src /var/www/html/fusio/src COPY ./.fusio.yml /var/www/html/fusio/.fusio.yml COPY ./composer.json /var/www/html/fusio/composer.json COPY ./composer.lock /var/www/html/fusio/composer.lock COPY ./configuration.php /var/www/html/fusio/configuration.php COPY ./container.php /var/www/html/fusio/container.php COPY ./provider.php /var/www/html/fusio/provider.php RUN chown -R www-data: /var/www/html/fusio RUN cd /var/www/html/fusio && composer install RUN a2enmod headers ``` -------------------------------- ### CLI Processor Response Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/cli-processor.md Shows the typical JSON response structure from the CLI Processor action, including the command's exit code and its standard output. ```json { "exitCode": 0, "output": "bar\n" } ``` -------------------------------- ### List Available Actions and Apps via CLI Source: https://github.com/apioo/fusio-docs/blob/main/docs/marketplace.md Use these commands to list all available actions and apps from the Fusio Marketplace via the command-line interface. ```bash php bin/fusio marketplace:list action ``` ```bash php bin/fusio marketplace:list app ``` -------------------------------- ### Deploy Resources Source: https://github.com/apioo/fusio-docs/blob/main/docs/ecosystem/framework.md Reads configuration files from the `resources/` folder and creates the fitting resources. ```bash php bin/fusio deploy ``` -------------------------------- ### API Test Case for GET Request Source: https://github.com/apioo/fusio-docs/blob/main/docs/development/testing.md Example of a test case for a GET request to an API endpoint. It sends a request and asserts the status code and JSON response body. ```php sendRequest('/page/2', 'GET', [ 'User-Agent' => 'Fusio TestCase', ]); $actual = (string) $response->getBody(); $expect = file_get_contents(__DIR__ . '/resource/entity_get.json'); $this->assertEquals(200, $response->getStatusCode(), $actual); $this->assertJsonStringEqualsJsonString($expect, $actual, $actual); } public function testPut() { $body = json_encode(['refId' => 2, 'title' => 'foo', 'content' => 'barbar']); $response = $this->sendRequest('/page/2', 'PUT', [ 'User-Agent' => 'Fusio TestCase', 'Authorization' => 'Bearer ' . $this->accessToken ], $body); $actual = (string) $response->getBody(); $expect = <<<'JSON' { "success": true, "message": "Page successful updated", "id": 2 } JSON; $this->assertEquals(200, $response->getStatusCode(), $actual); $this->assertJsonStringEqualsJsonString($expect, $actual, $actual); $actual = $this->connection->fetchAssociative('SELECT ref_id, title, content FROM app_page WHERE id = :id', ['id' => 2]); $expect = [ 'ref_id' => 2, 'title' => 'foo', 'content' => 'barbar', ]; $this->assertEquals($expect, $actual); } public function testDelete() { $response = $this->sendRequest('/page/2', 'DELETE', [ 'User-Agent' => 'Fusio TestCase', 'Authorization' => 'Bearer ' . $this->accessToken ]); $actual = (string) $response->getBody(); $expect = <<<'JSON' { "success": true, "message": "Page successful deleted", "id": 2 } JSON; $this->assertEquals(200, $response->getStatusCode(), $actual); $this->assertJsonStringEqualsJsonString($expect, $actual, $actual); $actual = $this->connection->fetchAssociative('SELECT id, title FROM app_page WHERE id = 2'); $expect = null; $this->assertEquals($expect, $actual); } } ``` -------------------------------- ### MongoDB Find All Example Response Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/mongodb-find-all.md This is an example JSON response when using the MongoDB Find All action. The structure includes total results, items per page, start index, and an array of entries. ```json { "totalResults": 2, "itemsPerPage": 16, "startIndex": 0, "entry": [ { "_id": "5344b4ddd2781d08c09790f4", "title": "bar", "content": "foo", "user": { "name": "bar", "uri": "http:\/\/google.com" } } ] } ``` -------------------------------- ### Generate SDK via Command Line Source: https://github.com/apioo/fusio-docs/blob/main/docs/development/generate_sdk.md Use this command to generate the SDK from the command line. The generated SDK will be written to the `output/` folder. ```bash php bin/fusio generate:sdk ``` -------------------------------- ### Elasticsearch GetAll Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/elasticsearch-getall.md Searches all documents at the configured index. This action can be bound to a route, for example, GET /document. It supports specific query parameters for execution and returns a structured JSON response. ```APIDOC ## GET /document ### Description Searches all documents at the configured index. ### Method GET ### Endpoint /document ### Query Parameters - **startIndex** (integer) - Optional - The start index. - **query** (string) - Optional - The search query i.e. `?query[title]=foo`. ### Response #### Success Response (200) - **totalResults** (integer) - The total number of results found. - **itemsPerPage** (integer) - The number of items per page. - **startIndex** (integer) - The starting index of the current results. - **entry** (array) - An array of document objects. - **title** (string) - The title of the document. - **description** (string) - The description of the document. - **insert_date** (string) - The date and time the document was inserted. - **id** (integer) - The unique identifier of the document (present in some entries). ### Response Example ```json { "totalResults": 2, "itemsPerPage": 16, "startIndex": 0, "entry": [ { "title": "foo bar", "description": "lorem ipsum", "insert_date": "2022-03-13T22:08:20+00:00" }, { "id": 1, "title": "hello world", "description": "lorem ipsum", "insert_date": "2022-03-13T22:07:53+00:00" } ] } ``` ``` -------------------------------- ### Create Fusio Project with Composer Source: https://github.com/apioo/fusio-docs/blob/main/docs/installation/index.md Use Composer to create a new Fusio project. This is a recommended method for downloading Fusio. ```bash composer create-project fusio/fusio ``` -------------------------------- ### Example MongoDB Document Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/mongodb-find-one.md This is an example of a document that can be returned by the MongoDB Find One action. The actual response depends on your specific data. ```json { "_id": "5344b4ddd2781d08c09790f4", "title": "foo", "content": "bar", "user": { "name": "foo", "uri": "http://google.com" } } ``` -------------------------------- ### Example Payload for SMTP Send Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/smtp-send.md This is an example payload that can be sent to the SMTP Send action. Dynamic values from this payload can be accessed within the HTML body. ```json { "hello": "world" } ``` -------------------------------- ### Run Fusio Docker Compose Source: https://github.com/apioo/fusio-docs/blob/main/docs/installation/docker.md Use this command to build and run the Fusio system with a predefined backend account. Ensure you review and change the default credentials in the `docker-compose.yml` file if deploying publicly. ```bash docker-compose up -d ``` -------------------------------- ### Redis Hash Get Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/redis-hash-get.md Retrieves a value for a specific field from a Redis hash. This action is typically bound to a route like `GET /values/:field`. ```APIDOC ## GET /values/:field ### Description Returns a value for a specific field from a Redis hash. ### Method GET ### Endpoint `/values/:field` ### Parameters #### Path Parameters - **field** (string) - Required - The field name to retrieve the value for. ### Response #### Success Response (200) - **value** (string) - The value associated with the specified field. ### Response Example ```json { "value": "foobar" } ``` ``` -------------------------------- ### Execute PHP Code with Worker-PHP Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/worker-php.md This example demonstrates how to execute PHP code within the Worker-PHP environment. It shows how to connect to a database, fetch data, and return a structured response. Ensure you have the necessary dependencies and configurations for the 'App' connection. ```php getConnection('App'); $filter = $request->getArguments()->get('filter'); $params = []; $query = 'SELECT id, title, content, insert_date FROM my_blog'; if (!empty($filter)) { $query .= ' WHERE title LIKE ?'; $params[] = $filter; } $entries = []; $result = $connection->fetchAllAssociative($query, $params); foreach ($result as $row) { $entries[] = [ 'id' => (int) $row['id'], 'name' => $row['title'], 'description' => $row['content'], 'insertDate' => $row['insert_date'], ]; } return $response->build(200, [], [ 'entries' => $entries, ]); }; ``` -------------------------------- ### Redis Hash Delete Response Example Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/redis-hash-delete.md This is an example of a successful response when a field is deleted from a Redis hash. The 'return' field indicates the number of fields deleted. ```json { "success": true, "message": "Field successfully deleted", "return": 1 } ``` -------------------------------- ### Fusio Migration Commands Overview Source: https://github.com/apioo/fusio-docs/blob/main/docs/development/migration.md A list of available commands for managing database migrations within Fusio. These commands cover diffing, dumping schema, executing, generating, and managing migration versions. ```bash migrations:diff [diff] Generate a migration by comparing your current database to your mapping information. migrations:dump-schema [dump-schema] Dump the schema for your database to a migration. migrations:execute [execute] Execute one or more migration versions up or down manually. migrations:generate [generate] Generate a blank migration class. migrations:latest [latest] Outputs the latest version migrations:list [list-migrations] Display a list of all available migrations and their status. migrations:migrate [migrate] Execute a migration to a specified version or the latest available version. migrations:rollup [rollup] Rollup migrations by deleting all tracked versions and insert the one version that exists. migrations:status [status] View the status of a set of migrations. migrations:sync-metadata-storage [sync-metadata-storage] Ensures that the metadata storage is at the latest version. migrations:up-to-date [up-to-date] Tells you if your schema is up-to-date. migrations:version [version] Manually add and delete migration versions from the version table. ``` -------------------------------- ### GET /files/:id Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/file-directory-get.md Returns details of a single file. This action should be bound to an operation like `GET /files/:id` where the `id` URI fragment is available. The action returns a file by this ID. ```APIDOC ## GET /files/:id ### Description Returns details of a single file. This action should be bound to an operation like `GET /files/:id` where the `id` URI fragment is available. The action returns a file by this ID. ### Method GET ### Endpoint /files/:id ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the file to retrieve. ### Response #### Success Response (200) - **fileName** (string) - The name of the retrieved file. - **content** (array) - The parsed content of the file, represented as an array of arrays. #### Response Example ```json { "fileName": "test_semicolon.csv", "content": [ [ "id", "name" ], [ "1", "foo" ], [ "2", "bar" ] ] } ``` ``` -------------------------------- ### Custom Action Implementation Source: https://github.com/apioo/fusio-docs/blob/main/docs/development/dependency_injection.md This is an example of a custom action class that extends Fusio's ActionAbstract. It demonstrates a simple `handle` method that returns a JSON response with a 'hello world' message. This class can be automatically registered and used within Fusio operations. ```php 'world', ]; return $this->response->build(200, [], $body); } } ``` -------------------------------- ### JSON-RPC Inspect Operation Response Source: https://github.com/apioo/fusio-docs/blob/main/docs/protocol/jsonrpc.md This is an example of a successful response from the inspect.get operation via JSON-RPC. ```json { "jsonrpc": "2.0", "result": { "arguments": { "foo": "bar" }, "payload": { "foo": "bar" }, "context": { "method": "inspect.get" } }, "id": 1 } ``` -------------------------------- ### JSON Patch Operations Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/util-json-patch.md An example of a JSON Patch document containing replace, add, and remove operations. ```json [ { "op": "replace", "path": "/baz", "value": "boo" }, { "op": "add", "path": "/hello", "value": ["world"] }, { "op": "remove", "path": "/foo" } ] ``` -------------------------------- ### GET /files Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/file-directory-getall.md Retrieves all files from a configured directory. Supports query parameters for pagination, sorting, and filtering. ```APIDOC ## GET /files ### Description Returns all files of a configured directory. This action can be bound to an operation like `GET /files`. ### Method GET ### Endpoint /files ### Query Parameters - **startIndex** (integer) - Optional - The start index. - **sortOrder** (string) - Optional - Sort the files by name either ASC or DESC. - **filterOp** (string) - Optional - The filter operator must be one of `contains`, `equals` or `startsWith`. - **filterValue** (string) - Optional - The filter value. ### Response #### Success Response (200) - **totalResults** (integer) - The total number of results. - **itemsPerPage** (integer) - The number of items per page. - **startIndex** (integer) - The start index of the current page. - **entry** (array) - An array of file objects. - **id** (string) - The unique identifier of the file. - **fileName** (string) - The name of the file. - **size** (integer) - The size of the file in bytes. - **contentType** (string) - The MIME type of the file. - **sha1** (string) - The SHA1 hash of the file content. - **lastModified** (string) - The last modified date of the file. #### Response Example ```json { "totalResults": 1, "itemsPerPage": 16, "startIndex": 0, "entry": [ { "id": "e13fe597-537e-36c2-b99a-d652c3021a36", "fileName": "test_semicolon.csv", "size": 19, "contentType": "text/plain", "sha1": "759c145ff96ed97db41dfa923a0a9fa71f058dbe", "lastModified": "0000-00-00T00:00:00+00:00" } ] } ``` ``` -------------------------------- ### Configure External Connections Source: https://github.com/apioo/fusio-docs/blob/main/docs/development/folder_structure.md Sets up additional connections, like a Stripe connection for payment processing. This configuration should be placed in `resources/connection.yaml`. ```yaml Stripe: class: "Fusio\Adapter\Stripe\Connection\Stripe" config: api_key: "${env.STRIPE_API_KEY}" ``` -------------------------------- ### Configure DI Container and Autowiring Source: https://github.com/apioo/fusio-docs/blob/main/docs/development/dependency_injection.md This snippet configures the DI container by building services and enabling autowiring for various application folders. It demonstrates how to load services from specific namespaces and directories, and how to mark them as public or exclude certain subdirectories. ```php load('App\\Action\\', __DIR__ . '/../src/Action'); $services->load('App\\Connection\\', __DIR__ . '/../src/Connection'); $services->load('App\\Service\\', __DIR__ . '/../src/Service') ->public(); $services->load('App\\Table\\', __DIR__ . '/../src/Table') ->exclude('Generated') ->public(); $services->load('App\\View\\', __DIR__ . '/../src/View'); }; ``` -------------------------------- ### Accessing GraphQLRequestContext in Action Source: https://github.com/apioo/fusio-docs/blob/main/docs/protocol/graphql.md Access the GraphQLRequestContext within an action to get the requested fields and optimize data fetching. ```php public function handle(RequestInterface $request, ParametersInterface $configuration, ContextInterface $context): HttpResponseInterface { $data = []; $resolveMyField = true; $context = $request->getContext(); if ($context instanceof GraphQLRequestContext) { $selection = $context->getFieldSelection(); $resolveMyField = isset($selection['my_field']) && $selection['my_field'] === true; } if ($resolveMyField) { // resolve my complex field $data['my_field'] = 'bar'; } return $this->response->build(200, [], $data); } ``` -------------------------------- ### Enable GraphQL Endpoint Source: https://github.com/apioo/fusio-docs/blob/main/docs/protocol/graphql.md Enable the GraphQL endpoint by setting 'fusio_graphql' to true in your configuration. ```php 'fusio_graphql' => true, ``` -------------------------------- ### Simple Login Source: https://github.com/apioo/fusio-docs/blob/main/docs/security/authorization.md Obtain an access token using the simple `/consumer/login` endpoint by providing username and password. ```APIDOC ## POST /consumer/login ### Description Obtains an access token using the simple consumer login endpoint. ### Method POST ### Endpoint /consumer/login ### Request Body - **username** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. ### Request Example ```json { "username": "[username]", "password": "[password]" } ``` ### Response #### Success Response (200) - **token** (string) - The obtained access token. ``` -------------------------------- ### GET /document Source: https://github.com/apioo/fusio-docs/blob/main/docs/backend/api/action/mongodb-find-all.md Retrieves all documents from the configured MongoDB collection. Supports query parameters for pagination, sorting, and filtering. ```APIDOC ## GET /document ### Description Returns all documents of the configured collection. This action should be bound to a route like `GET /document`. ### Method GET ### Endpoint /document ### Query Parameters - **startIndex** (integer) - Optional - The start index of the collection. - **count** (integer) - Optional - The document per count page. - **sortBy** (string) - Optional - The sort by property. - **sortOrder** (string) - Optional - The sort order must be either `ASC` or `DESC`. - **filterBy** (string) - Optional - The filter by property. - **filterValue** (string) - Optional - The filter value. ### Response #### Success Response (200) - **totalResults** (integer) - The total number of results. - **itemsPerPage** (integer) - The number of items per page. - **startIndex** (integer) - The starting index of the results. - **entry** (array) - An array of documents from the collection. - **_id** (string) - The document ID. - **title** (string) - The document title. - **content** (string) - The document content. - **user** (object) - Information about the user. - **name** (string) - The user's name. - **uri** (string) - The user's URI. ### Response Example ```json { "totalResults": 2, "itemsPerPage": 16, "startIndex": 0, "entry": [ { "_id": "5344b4ddd2781d08c09790f4", "title": "bar", "content": "foo", "user": { "name": "bar", "uri": "http:\/\/google.com" } } ] } ``` ```