noi-techpark / it.bz.opendatahub.databrowser

Explore and navigate through Open Data you need to build your next service.
https://databrowser.opendatahub.com
GNU Affero General Public License v3.0
8 stars 7 forks source link

API url for mobility is generated as tourism url #407

Closed ila131 closed 11 months ago

ila131 commented 1 year ago

Hey @gappc, Delia and I encountered an issue regarding the API URL in the metadata. We wanted to put also the mobility datasets but the API URL that is automatically generated from the path and filter has always the tourism domain: https://api.tourism.testingmachine.eu/

Screenshot 2023-07-13 at 14 07 53

Have a nice day, Ilaria

sseppi commented 1 year ago

Hi @gappc , now that we are starting to integrate the second domain we should consider this issue to avoid the input of wrong api links. Best Stefano

gappc commented 1 year ago

@ila131 thank you for submitting this issue. Could you please provide a step-by-step explanation of what you were doing and expecting? I'm not sure if understand what you mean. Is it about the MetaData API?

ila131 commented 1 year ago

yes it is about the MetaData, sorry for not specifying it. I wanted to add a new record in the meta data, but while doing that the API url was generated by taking the tourism domain (see attachment) but it should take the mobility domain. The expected API URL should be something like https://api.**mobility**.testingmachine.eu/v2/flat/ParkingSensor

Screenshot 2023-07-13 at 15 47 11
gappc commented 1 year ago

@ila131 @sseppi the behavior you see comes from the backend. At the moment there is no way to specify the domain to use.

@RudiThoeni is that correct? How could we manage to add the domain?

RudiThoeni commented 1 year ago

yes this is correct ApiUrl is generated from the backend..... What i can do is set it to freely editable? or adding a field with domain which is added on the generated ApiUrl, what do you prefer?

gappc commented 1 year ago

@RudiThoeni good question. My first idea was to make it freely editable, but that has the major drawback that it is not clear from the URL which parts of the URL define an endpoint. That information is stored at the moment in PathParam.

I think the better idea would be to have the domain as separate field, but with a minor change: I'd call it BaseUrl. Calling it BaseUrl instead of e.g. Domain allows us to have base paths that not only contain a domain, but that may also have some other paths in between before the PathParam part, e.g. https://api.tourism.testingmachine.eu/v1/Municipality could also be located at https://api.tourism.testingmachine.eu/some-other-path/v1/Municipality. In that case, the BaseUrl would be https://api.tourism.testingmachine.eu/some-other-path. Calling such a value Domain could lead to confusion.

@RudiThoeni what is your opinion?

RudiThoeni commented 1 year ago

@gappc BaseUrl is fine for me, i think also the better idea is to have this info stored in a separate field....... so i will create it and inform you when done?

gappc commented 1 year ago

@RudiThoeni if the change can be implemented without breaking the current frontend then yes, please go on. Otherwise we must synchronize the backend and frontend releases.

RudiThoeni commented 1 year ago

I think it should not break the frontend because all existing fields are returned like before..... I will try :)

RudiThoeni commented 1 year ago

@gappc I added the BaseUrl and populated it... to not break the frontend i added it as nullable..... can you check if it is still working?

"ApiUrl": "https://api.tourism.testingmachine.eu/v1/Municipality", "BaseUrl": "https://api.tourism.testingmachine.eu",

sseppi commented 12 months ago

@ila131 can you please test and let us know if now is working everything as expected?

ila131 commented 11 months ago

Now when adding a new record the API Url gives you only the path and not the whole URL (see first row of the screenshot). Instead before the API Url was automatically generated from the path (see second row of the screenshot). Was this the idea?

Screenshot 2023-07-25 at 17 06 51
RudiThoeni commented 11 months ago

you have to add the BaseUrl it is null

ApiUrl is readonly and generated out of BaseUrl + PathParameter + ApiFilters

{
"Id": "178ea911-cc54-418e-b42e-52cad18f1ec1",
"Self": "https://api.tourism.testingmachine.eu/v1/MetaData/178ea911-cc54-418e-b42e-52cad18f1ec1",
"_Meta": {
"Id": "178ea911-cc54-418e-b42e-52cad18f1ec1",
"Type": "odhmetadata",
"Source": "noi",
"Reduced": false,
"LastUpdate": "2023-07-25T15:05:45.5404203+00:00",
"UpdateInfo": {
"UpdatedBy": "bolzanoir@gmail.com",
"UpdateSource": "https://databrowser.opendatahub.testingmachine.eu/"
}
},
"ApiUrl": "/v2/flat/ParkingStation",
"Output": null,
"BaseUrl": null,
"ODHTags": [],
"OdhType": null,
"Sources": null,
"ApiAccess": null,
"ApiFilter": [],
"OdhTagIds": null,
"PathParam": [
"v2/flat/ParkingStation"
],
"Shortname": "Parking Station",
"Deprecated": false,
"LastChange": "2023-07-25T15:05:45.5404203+00:00",
"SwaggerUrl": "https://mobility.api.opendatahub.com/",
"FirstImport": "2023-07-25T14:54:56.2158395+00:00",
"PublishedOn": null,
"RecordCount": null,
"ImageGallery": null,
"SingleDataset": false,
"ApiDescription": {
"en": "Parking stations - off street parking data (Bolzano, Merano, Trento, Rovereto). Slot availability and predictions. "
}
}
ila131 commented 11 months ago

thank you for your quick answer! But how can I implement the BaseUrl from the databrowser @gappc ? Should I add a "BaseUrl" field?

gappc commented 11 months ago

@ila131 yes I think that's the way to go at the moment. Please be aware that there are ongoing discussions about the MetaData API, its shape may change in the future.

ila131 commented 11 months ago

thank you @gappc for your answer and the information. So, in the meantime I will implement the "BaseUrl".

gappc commented 11 months ago

Done as of bc7ddeb570f10008920b6f3a01d2a79dd21e6711