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

Issue 58 api documentation lists each endpoint twice #59

Merged
merged 4 commits into from Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions documentation/changelog.rst
Expand Up @@ -3,6 +3,14 @@ FlexMeasures Changelog
**********************


v0.2.4 | March XX, 2021
===========================

Bugfixes
--------
* Documentation listed 2.0 API endpoints twice [see `PR #59 <http://www.github.com/SeitaBV/flexmeasures/pull/59>`_]


v0.2.3 | February 27, 2021
===========================

Expand Down
4 changes: 2 additions & 2 deletions flexmeasures/api/v1/routes.py
Expand Up @@ -34,7 +34,7 @@
def get_meter_data():
"""API endpoint to get meter data.
.. :quickref: User; Download meter data from the platform
.. :quickref: Data; Download meter data from the platform
**Optional parameters**
Expand Down Expand Up @@ -99,7 +99,7 @@ def get_meter_data():
def post_meter_data():
"""API endpoint to post meter data.
.. :quickref: User; Upload meter data to the platform
.. :quickref: Data; Upload meter data to the platform
**Optional parameters**
Expand Down
10 changes: 5 additions & 5 deletions flexmeasures/api/v1_1/routes.py
Expand Up @@ -62,7 +62,7 @@
def get_connection():
"""API endpoint to get the user's connections as entity addresses ordered from newest to oldest.

.. :quickref: User; Retrieve entity addresses of connections
.. :quickref: Data; Retrieve entity addresses of connections
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd reserve the "Data" quickref for time series data only. "Assets" fits better here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.



**Example request**
Expand Down Expand Up @@ -115,7 +115,7 @@ def get_connection():
def post_price_data():
"""API endpoint to post price data.

.. :quickref: User; Upload price data to the platform
.. :quickref: Data; Upload price data to the platform

**Optional parameters**

Expand Down Expand Up @@ -203,7 +203,7 @@ def post_weather_data():

The sensor type is part of the unique entity address for each sensor, together with the sensor's latitude and longitude.

.. :quickref: User; Upload weather data to the platform
.. :quickref: Data; Upload weather data to the platform

**Optional parameters**

Expand Down Expand Up @@ -271,7 +271,7 @@ def post_weather_data():
def get_prognosis():
"""API endpoint to get prognosis.

.. :quickref: User; Download prognosis from the platform
.. :quickref: Control; Download prognosis from the platform
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I don't understand the logic behind your chosen categories, but I think this should be "Data" instead of "Control". Similarly for POSTing prognoses.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm on the fence with this one. Not sure if we need those labels for a long time and that it matters much. I'll go with your suggestion.


**Optional parameters**

Expand Down Expand Up @@ -339,7 +339,7 @@ def get_prognosis():
def post_prognosis():
"""API endpoint to post prognoses about meter data.

.. :quickref: User; Upload prognosis to the platform
.. :quickref: Control; Upload prognosis to the platform

**Optional parameters**

Expand Down
4 changes: 2 additions & 2 deletions flexmeasures/api/v1_2/routes.py
Expand Up @@ -43,7 +43,7 @@
def get_device_message():
"""API endpoint to get device message.
.. :quickref: User; Download control signal from the platform
.. :quickref: Control; Download control signal from the platform
**Optional parameters**
Expand Down Expand Up @@ -101,7 +101,7 @@ def get_device_message():
def post_udi_event():
"""API endpoint to post UDI event.
.. :quickref: User; Upload flexibility constraints to the platform
.. :quickref: Control; Upload flexibility constraints to the platform
**Example request**
Expand Down
4 changes: 2 additions & 2 deletions flexmeasures/api/v1_3/routes.py
Expand Up @@ -25,7 +25,7 @@
def get_device_message():
"""API endpoint to get device message.
.. :quickref: User; Download control signal from the platform
.. :quickref: Control; Download control signal from the platform
**Optional parameters**
Expand Down Expand Up @@ -82,7 +82,7 @@ def get_device_message():
def post_udi_event():
"""API endpoint to post UDI event.
.. :quickref: User; Upload flexibility constraints to the platform
.. :quickref: Control; Upload flexibility constraints to the platform
**Example request A**
Expand Down
17 changes: 14 additions & 3 deletions flexmeasures/ui/__init__.py
@@ -1,6 +1,7 @@
import os

from flask import current_app, Flask, Blueprint
from flask.blueprints import BlueprintSetupState
from flask import send_from_directory
from flask_security import login_required, roles_accepted
import numpy as np
Expand Down Expand Up @@ -58,10 +59,20 @@ def favicon():
add_jinja_filters(app)
add_jinja_variables(app)

# re-register api blueprint so it'll register the chart views (the ones in views.charts)
app.register_blueprint(
flexmeasures_api_v2_0, url_prefix="/api/v2_0", first_registration=False
# Add our chart endpoint to the Api 2.0 blueprint.
# This lets it show up in the API list twice, but that seems to be the best way for now (see below).
# Also, we'll reconsider where these charts endpoints should really live when we make more.
from flexmeasures.ui.views.charts import get_power_chart

# We cannot call this directly on the blueprint, as that only defers to registration.
# Re-registering the blueprint leads to all endpoints being listed twice.
blueprint_state = BlueprintSetupState(
flexmeasures_api_v2_0,
app,
{"url_prefix": "/api/v2_0"},
first_registration=False,
)
blueprint_state.add_url_rule("/charts/power", None, get_power_chart)


def register_rq_dashboard(app):
Expand Down