Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor cleanup to rest api page #763

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions source/user-guide/foundriesio-rest-api/foundriesio-rest-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Foundries.io REST API
=====================

Foundries.io™ implements a `REST API`_ that allows users to interact with their Factory and devices.
This section examples use of the REST API with cURL_ (command-line tool for transferring data using various network protocols).
The FoundriesFactory™ Platform implements a `REST API`_ that allows you to interact with you Factory and devices.
This section examples use of the REST API with `curl`_ (command-line tool for transferring data using various network protocols).

To follow this section, it is important to have:

Expand All @@ -16,9 +16,12 @@ Prerequisites
Creating Token
--------------

To interact with the `Foundries.io API <https://api.foundries.io/ota/>`_, create a token.
.. tip::
To access the API, you must first login to your Factory.

Go to `Tokens <https://app.foundries.io/settings/tokens/>`_ and create a new **Api Token** by clicking on
To interact with the `Foundries.io API`_, create a token.

Go to `Tokens <https://app.foundries.io/settings/tokens/>`_ and create a new **API Token** by clicking on
:guilabel:`+ New Token`.

Complete with a **Description** and **Expiration date**, and select :guilabel:`next`.
Expand All @@ -36,7 +39,7 @@ Save the output, as this is is your ``<API_TOKEN>`` value.
Getting Started
---------------

The `Foundries.io API <https://api.foundries.io/ota/>`_ includes a complete `OpenAPI <https://swagger.io/specification/>`_ definition.
The `Foundries.io API`_ includes a complete `OpenAPI <https://swagger.io/specification/>`_ definition.
To get started, configure your host terminal with the variables below:

.. prompt:: bash host:~$, auto
Expand All @@ -53,7 +56,7 @@ Device List

This function returns a list of devices registered in your Factory.
The HTTP response includes the same data from your Factory's :guilabel:`Devices` tab.
Documentation can be found at `Foundries.io API <https://api.foundries.io/ota/>`_ under `devices`.
Documentation can be found at `Foundries.io API`_ under ``devices``.

Run:

Expand Down Expand Up @@ -101,7 +104,7 @@ Targets List

This function returns a list of your Factory targets.
The HTTP response includes the same data from the :guilabel:`Targets` tab of the Factory.
You can find documentation at `Foundries.io API <https://api.foundries.io/ota/>`_ under `factories`.
You can find documentation at `Foundries.io API`_ under ``factories``.

Run:

Expand Down Expand Up @@ -191,7 +194,7 @@ To send a configuration file named ``app.config`` to your device.

host:~$ export API_DATA='{ "reason": "API test", "files": [{"name":"app.config","unencrypted":true,"value":"[page]\nurl = \"https://foundries.io/\"\n"}]}'

#. Define ``DEVICE_NAME`` and configure your device using cURL_ with ``-X PATCH``:
#. Define ``DEVICE_NAME`` and configure your device using curl_ with ``-X PATCH``:

.. prompt:: bash host:~$, auto

Expand Down Expand Up @@ -247,7 +250,7 @@ The command below adds the JSON to the ``API_DATA`` variable:

host:~$ export API_DATA='{ "reason": "API test", "files": [{"name":"z-50-fioctl.toml","on-changed":["/usr/share/fioconfig/handlers/aktualizr-toml-update"],"unencrypted":true,"value":"\n[pacman]\n compose_apps = \"shellhttpd\"\n"}]}'

Define the variable ``DEVICE_NAME`` and configure your device using cURL_ with ``-X PATCH``:
Define the variable ``DEVICE_NAME`` and configure your device using curl_ with ``-X PATCH``:

.. prompt:: bash host:~$, auto

Expand All @@ -261,7 +264,7 @@ Define the variable ``DEVICE_NAME`` and configure your device using cURL_ with `
Learning More About the REST API
--------------------------------

Logged into http://app.foundries.io, you may interact with the REST API from your browser at http://api.foundries.io/ota.
Logged into http://app.foundries.io, you may interact with the REST API from your browser at http://api.foundries.io/ota.

1. Click on the operation to test.
This shows the :guilabel:`Try it out` option.
Expand All @@ -270,7 +273,7 @@ Logged into http://app.foundries.io, you may interact with the REST API from yo

3. :guilabel:`Execute` to test.

4. Once executed, it displays a cURL_ command reference.
4. Once executed, it displays a curl_ command reference.

5. Check the response:

Expand All @@ -283,4 +286,5 @@ Logged into http://app.foundries.io, you may interact with the REST API from yo
This allows you to explore the Foundries.io REST API and its possibilities.

.. _REST API: https://en.wikipedia.org/wiki/Representational_state_transfer
.. _cURL: https://curl.se/
.. _curl: https://curl.se/
.. _Foundries.io API: https://api.foundries.io/
Loading