doc: markup JSON and HTTP API as any role

Co-authored-by: Roberto Abdelkader Martínez Pérez <robertomartinezp@gmail.com>
This commit is contained in:
pancho horrillo
2019-12-11 13:05:39 +01:00
parent 4102834167
commit 09e842f199
3 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ What's *Kapow!*
=============== ===============
Think of that **software** that you need but **only runs in the command Think of that **software** that you need but **only runs in the command
line**. *Kapow!* lets you **wrap it into an HTTP API in the easiest line**. *Kapow!* lets you **wrap it into an :any:`HTTP API` in the easiest
way possible**. way possible**.
.. image:: _static/kapow-quick-overview.png .. image:: _static/kapow-quick-overview.png
+3 -3
View File
@@ -89,7 +89,7 @@ Ok, let's analyze *Kapow!* and check if it is compatible with our constraints:
to waste time**. to waste time**.
3. By using *Kapow!* we can run any command in the ``External Host`` 3. By using *Kapow!* we can run any command in the ``External Host``
limiting the command parameters, so **it's safe**. limiting the command parameters, so **it's safe**.
4. By using *Kapow!* we can launch any system command as an ``HTTP API`` easily, so 4. By using *Kapow!* we can launch any system command as an :any:`HTTP API` easily, so
**we don't need to grant login access to** ``External Host`` **to **we don't need to grant login access to** ``External Host`` **to
anybody**. anybody**.
@@ -125,7 +125,7 @@ file like this:
Explanation: Explanation:
1. ``kapow route add /ping`` - adds a new ``HTTP API`` endpoint at ``/ping`` 1. ``kapow route add /ping`` - adds a new :any:`HTTP API` endpoint at ``/ping``
path in the *Kapow!* server. You have to use ``GET`` method to invoke the path in the *Kapow!* server. You have to use ``GET`` method to invoke the
endpoint. endpoint.
2. ``-c`` - after this parameter we write the system command that *Kapow!* 2. ``-c`` - after this parameter we write the system command that *Kapow!*
@@ -172,4 +172,4 @@ following diagram:
:width: 80% :width: 80%
As you can see, *Kapow!* provides the necessary *magic* to turn a **system As you can see, *Kapow!* provides the necessary *magic* to turn a **system
command** into an ``HTTP API``. command** into an :any:`HTTP API`.
+9 -9
View File
@@ -29,7 +29,7 @@ Sharing the Stats
**Senior** **Senior**
We have to provide a new endpoint to serve the same data but in JSON We have to provide a new endpoint to serve the same data but in :any:`JSON`
format. format.
**Junior** **Junior**
@@ -46,7 +46,7 @@ Sharing the Stats
**Senior** **Senior**
For starters, that's not valid ``JSON``. The output would be something like: For starters, that's not valid :any:`JSON`. The output would be something like:
.. code-block:: console .. code-block:: console
@@ -55,7 +55,7 @@ Sharing the Stats
Mem: 31967 3121 21680 980 7166 27418 Mem: 31967 3121 21680 980 7166 27418
Swap: 0 0 0"} Swap: 0 0 0"}
You can't add new lines inside a ``JSON`` string that way, you have to escape You can't add new lines inside a :any:`JSON` string that way, you have to escape
the new line characters as ``\n``. the new line characters as ``\n``.
**Junior** **Junior**
@@ -77,15 +77,15 @@ Sharing the Stats
**Senior** **Senior**
:program:`jq` is a wonderful tool for working with ``JSON`` data from the command :program:`jq` is a wonderful tool for working with :any:`JSON` data from the command
line. With :program:`jq` you can extract data from a ``JSON`` document and it also line. With :program:`jq` you can extract data from a :any:`JSON` document and it also
allows you to generate a well-formed ``JSON`` document. allows you to generate a well-formed :any:`JSON` document.
**Junior** **Junior**
Let's use it, then! Let's use it, then!
How can we generate a ``JSON`` document with :program:`jq`? How can we generate a :any:`JSON` document with :program:`jq`?
**Senior** **Senior**
@@ -104,7 +104,7 @@ Sharing the Stats
**Senior** **Senior**
Bear with me, it gets better. You can add variables to the ``JSON`` and Bear with me, it gets better. You can add variables to the :any:`JSON` and
:program:`jq` will escape them for you. :program:`jq` will escape them for you.
.. code-block:: console .. code-block:: console
@@ -165,7 +165,7 @@ Sharing the Stats
**Junior** **Junior**
I don't think so! the ``JSON`` is well-formed and it contains all the required I don't think so! the :any:`JSON` is well-formed and it contains all the required
data. And the code is quite readable. data. And the code is quite readable.
**Senior** **Senior**