Skip to content

Commit

Permalink
fix indention
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Jan 9, 2018
1 parent c02abab commit cfb1319
Showing 1 changed file with 36 additions and 37 deletions.
73 changes: 36 additions & 37 deletions doc/get_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,42 @@ contains several keys:
is public or private, the available request/response schema and also the
action which should be executed:

.. code-block:: yaml
.. code-block:: yaml
"/todo": !include resources/routes/todo/collection.yaml
"/todo/:todo_id": !include resources/routes/todo/entity.yaml
"/todo": !include resources/routes/todo/collection.yaml
"/todo/:todo_id": !include resources/routes/todo/entity.yaml
* **schema**

Contains the available request and response schema in the JSON-Schema format:

.. code-block:: yaml
.. code-block:: yaml
Todo: !include resources/schema/todo/entity.json
Todo-Collection: !include resources/schema/todo/collection.json
Message: !include resources/schema/message.json
Todo: !include resources/schema/todo/entity.json
Todo-Collection: !include resources/schema/todo/collection.json
Message: !include resources/schema/message.json
* **connection**

Provides connections to a remote service i.e. mysql or mongodb. This
connection can be used inside an action:

.. code-block:: yaml
.. code-block:: yaml
Default-Connection:
class: Fusio\Adapter\Sql\Connection\SqlAdvanced
config:
url: "sqlite:///${dir.cache}/todo-app.db"
Default-Connection:
class: Fusio\Adapter\Sql\Connection\SqlAdvanced
config:
url: "sqlite:///${dir.cache}/todo-app.db"
* **migration**

Through migrations it is possible to execute i.e. sql queries on a connection.
This allows you to change your database schema on deployment.

.. code-block:: yaml
.. code-block:: yaml
Default-Connection:
- resources/migration/v1_schema.php
Default-Connection:
- resources/migration/v1_schema.php
Through the command ``php bin/fusio deploy`` you can deploy the API. It is now
possible to visit the API endpoint at: ``/todo``.
Expand All @@ -74,24 +74,24 @@ access token in order to send a POST request.
Now you can obtain a JWT through a simple HTTP request to the
``consumer/login`` endpoint.

.. code-block:: http
.. code-block:: http
POST /consumer/login HTTP/1.1
Host: 127.0.0.1
Content-Type: application/json
POST /consumer/login HTTP/1.1
Host: 127.0.0.1
Content-Type: application/json
{
"username": "[username]",
"password": "[password]"
}
{
"username": "[username]",
"password": "[password]"
}
Which returns a token i.e.:

.. code-block:: json
.. code-block:: json
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI5N2JkNDUzYjdlMDZlOWFlMDQxNi00YmY2MWFiYjg4MDJjZmRmOWZmN2UyNDg4OTNmNzYyYmU5Njc5MGUzYTk4NDQ3MDEtYjNkYTk1MDYyNCIsImlhdCI6MTQ5MTE2NzIzNiwiZXhwIjoxNDkxMTcwODM2LCJuYW1lIjoidGVzdCJ9.T49Af5wnPIFYbPer3rOn-KV5PcN0FLcBVykUMCIAuwI"
}
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI5N2JkNDUzYjdlMDZlOWFlMDQxNi00YmY2MWFiYjg4MDJjZmRmOWZmN2UyNDg4OTNmNzYyYmU5Njc5MGUzYTk4NDQ3MDEtYjNkYTk1MDYyNCIsImlhdCI6MTQ5MTE2NzIzNiwiZXhwIjoxNDkxMTcwODM2LCJuYW1lIjoidGVzdCJ9.T49Af5wnPIFYbPer3rOn-KV5PcN0FLcBVykUMCIAuwI"
}
Note this generates an OAuth2 token with contains all scopes from your user
account. It is also possible to use the OAuth2 endpoint `/authorization/token`
Expand All @@ -102,15 +102,14 @@ access token in order to send a POST request.
Now we can use the JWT as Bearer token in the ``Authorization`` header to
access the protected endpoint.

.. code-block:: http
.. code-block:: http
POST /todo HTTP/1.1
Host: 127.0.0.1
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI5N2JkNDUzYjdlMDZlOWFlMDQxNi00YmY2MWFiYjg4MDJjZmRmOWZmN2UyNDg4OTNmNzYyYmU5Njc5MGUzYTk4NDQ3MDEtYjNkYTk1MDYyNCIsImlhdCI6MTQ5MTE2NzIzNiwiZXhwIjoxNDkxMTcwODM2LCJuYW1lIjoidGVzdCJ9.T49Af5wnPIFYbPer3rOn-KV5PcN0FLcBVykUMCIAuwI
Content-Type: application/json
POST /todo HTTP/1.1
Host: 127.0.0.1
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI5N2JkNDUzYjdlMDZlOWFlMDQxNi00YmY2MWFiYjg4MDJjZmRmOWZmN2UyNDg4OTNmNzYyYmU5Njc5MGUzYTk4NDQ3MDEtYjNkYTk1MDYyNCIsImlhdCI6MTQ5MTE2NzIzNiwiZXhwIjoxNDkxMTcwODM2LCJuYW1lIjoidGVzdCJ9.T49Af5wnPIFYbPer3rOn-KV5PcN0FLcBVykUMCIAuwI
Content-Type: application/json
{
"title": "lorem ipsum",
"content": "lorem ipsum"
}
{
"title": "lorem ipsum",
"content": "lorem ipsum"
}

0 comments on commit cfb1319

Please sign in to comment.