-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add About page, Integration via API page (#156)
* Improve About * Add API * Add links to API and links
- Loading branch information
1 parent
b60957b
commit ba9fd18
Showing
6 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.. _about: | ||
|
||
About | ||
***** | ||
|
||
By selecting the :guilabel:`About` option from the :doc:`./index` menu, users are directed to the About page. This page offers detailed information about the current versions and build timestamps of the tool's components. This level of transparency helps ensure that both users and developers are fully informed about the specific versions and build statuses of the components they are working with. | ||
|
||
The :guilabel:`API URL` link provides access to the server's API endpoints, which can be used for integrating the Data Stewardship Wizard with other systems and automating tasks. | ||
|
||
The :guilabel:`API Documentation` link directs to the API documentation presented in Swagger UI that provides detailed descriptions of available operations and parameters. | ||
|
||
.. figure:: about/modal.png | ||
:width: 500 | ||
|
||
Modal window with versions of the tool's components. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
******************* | ||
Integration via API | ||
******************* | ||
|
||
An Application Programming Interface (API) allows machines, such as other systems and tools, to perform actions and transfer data based on agreed-upon methods. | ||
|
||
By selecting the :guilabel:`About` option from the :ref:`Profile<profile>` menu, users are directed to the :ref:`About<about>` page where the :guilabel:`API URL` and :guilabel:`API Docs` are provided. Each instance includes SwaggerUI API Documentation, which allows you to explore all operations and data transfer and also you to directly try out the API calls, with example responses provided for guidance. | ||
|
||
Authentication and Authorization | ||
================================ | ||
|
||
DSW utilizes JSON Web Tokens (JWT) for both authentication and authorization, ensuring secure access and control over API interactions. To obtain a token, you must have a user account, and there are multiple methods to acquire one: | ||
|
||
* **Credentials** (Email + Password): Send a POST request to /tokens with your email and password. If your credentials are correct and your account is active, you will receive a token along with its expiration time in the response. | ||
* **OpenID Identity Provider** (for our client only): This method involves a more complex OpenID/OAuth flow, utilizing redirects with the ``/auth/{id}/`` endpoints to authenticate. | ||
* **API Keys**: You can generate an API key in your user profile, which remains valid until its specified expiration date. | ||
|
||
While several public endpoints are accessible without authentication, most endpoints require it. The system will check if you are authorized to perform specific operations based on your :ref:`roles<user-roles>` and their permissions. These roles are defined globally and can also be specific to projects. This ensures that only authorized users can access and manipulate with sensitive resources. | ||
|
||
Example | ||
======= | ||
|
||
After obtaining your authentication token and reviewing the API documentation, you can start making API calls to execute actions and transfer data, easily integrating them into your projects. Here's a simple example using the `Requests library in Python <https://requests.readthedocs.io/en/latest/>`__: | ||
|
||
.. code-block:: | ||
import requests | ||
API_URL = '...' | ||
API_KEY = '...' | ||
response = requests.get( | ||
url=f'{API_URL}/users/current', | ||
headers={'Authorization': f'Bearer {API_KEY}'}, | ||
) | ||
response.raise_for_status() | ||
user = response.json() | ||
print(f'This API Key belongs to {user["email"]}') | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters