-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
/server/*
endpoint group to REST API
This includes the implementation of the endpoints `/server/info` and `/server/endpoints`. There are some slight changes over the old REST API: * The endpoint `/server/` has been moved to `/server/info` * The key name in the response of endpoint `/server/endpoints` has been changed from `available_endpoints` to `endpoints` * The strings in the response of endpoint `/server/endpoints` has been splitted up into a dictionary with keys "methods", "group", "path" that contain the same information as the strings but structured * Updated API version to the version of the repo. This required a new file to prevent circular imports
- Loading branch information
1 parent
366f036
commit e4162d2
Showing
5 changed files
with
94 additions
and
23 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
"""AiiDA REST API for data queries and workflow managment.""" | ||
|
||
__version__ = '0.1.0a1' | ||
__version__ = '0.1.0a' | ||
|
||
from .main import app # noqa: F401 |
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
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,26 @@ | ||
"""Declaration of FastAPI application.""" | ||
|
||
from typing import Any | ||
|
||
from aiida import __version__ as aiida_version | ||
from fastapi import APIRouter | ||
|
||
from aiida_restapi.config import API_CONFIG | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get('/server/info', response_model=dict[str, Any]) | ||
async def get_server_info() -> dict[str, Any]: | ||
"""Get the API version information""" | ||
response = {} | ||
api_version = API_CONFIG['VERSION'].split('.') | ||
response['API_major_version'] = api_version[0] | ||
response['API_minor_version'] = api_version[1] | ||
response['API_revision_version'] = api_version[2] | ||
# Add Rest API prefix | ||
response['API_prefix'] = API_CONFIG['PREFIX'] | ||
|
||
# Add AiiDA version | ||
response['AiiDA_version'] = aiida_version | ||
return response |
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