Skip to content

Commit

Permalink
updated docs for app:register rework
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 committed Nov 27, 2023
1 parent 20cf885 commit 14a413d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [1.3.0 - 2023-12-0x]
## [1.3.0 - 2023-11-28]

### Changed

- Reworked: algorithm of `app:register` and occ cli command, "/init" endpoint now is optional. #128
- Reworked: `app_api:app:unregister` occ cli command, make it much robust. #127

## [1.2.2 - 2023-11-13]
Expand Down
6 changes: 5 additions & 1 deletion docs/tech_details/Deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ Application installation scheme
1. AppAPI deploys the application and launches it.
2. AppAPI for `N` seconds (default ``90``) checks the ``/heartbeat`` endpoint with ``GET`` request.
3. AppAPI sends a ``POST`` to the ``/init`` endpoint.
4. ExApp sends an integer from ``0`` to ``100` to the OCS endpoint ``apps/app_api/apps/status`` indicating the initialization progress. After sending ``100``, the application is considered initialized.

.. note:: if ExApp do not implements ``/init`` endpoint and
AppAPI receives 501 or 401 status error, AppAPI enables the application by going to point 5.

4. **ExApp** sends an integer from ``0`` to ``100`` to the OCS endpoint ``apps/app_api/apps/status`` indicating the initialization progress. After sending ``100``, the application is considered initialized.
5. AppAPI sends a PUT to the ``/enabled`` endpoint.

ExApp info.xml schema
Expand Down
16 changes: 7 additions & 9 deletions docs/tech_details/InstallationFlow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,18 @@ The application, in response to the request "/heartbeat", should return json: ``
Init
----

.. note:: Starting from this point, all requests made by AppAPI contains :ref:`auth-headers`.

After application is ready, which is determined by previous step,
AppAPI sends ``POST`` request to the ``/init`` application endpoint.

*Application should response with empty JSON, if initialization takes long time it should be done in background and not in this request handler.*

.. note:: Starting from this point, all requests made by AppAPI contains :ref:`auth-headers`.

If the application does not need to carry out long initialization, it can immediately execute an ``OCS request`` to
``/ocs/v1.php/apps/app_api/apps/status/$APP_ID`` with such a payload in json format::
*If the application does not need to carry out long initialization, it has an option to not implement "/init" endpoint, so
AppAPI will get 404 or 501 error on it's request, and consider that initialization is done and this section can be skipped.*

{"progress": 100}
In case you want to implement "/init" endpoint, your application should:

If the application initialization takes a long time, the application should periodically send an ``OCS request`` to
``/ocs/v1.php/apps/app_api/apps/status/$APP_ID`` with the progress value.
1. In "/init" handler: Response with empty JSON on AppAPI call.
2. In background job: Send an ``OCS request`` to ``/ocs/v1.php/apps/app_api/apps/status/$APP_ID`` with the progress value.

Possible values for **progress** are integers from 1 to 100;
after receiving the value 100, the **application is considered initialized and ready to work**.
Expand Down

0 comments on commit 14a413d

Please sign in to comment.