teamdigitale / dati-semantic-frontend

Frontend for the NDC semantic repository
GNU Affero General Public License v3.0
5 stars 10 forks source link

API usage from Controlled Vocabulary details page #117

Closed ronytw closed 1 year ago

ronytw commented 2 years ago

Expected behaviour

The "API" button from the details page of a Controlled Vocabulary should take the user to the api-docs page, where the swagger-ui of the OAS3 is presented, with indication of what the values are for agency_id and key_concept for the given CV, and where to use them in the API.

Current behaviour

The "API" button from the details page of a Controlled Vocabulary points to the REST API endpoint for retrieving the list of entries in the given vocabulary. The browser will perform the call and render the JSON content in a new tab.

Proposed solution

The api-docs page could extract the CV's IRI from a query-param, to determine whether to show additional contextual information in the introductory text (see #116). The text could read something like

In the case of the , you should use the /vocabularies/{agency_id}/{key_concept} API, where you can use for agency_id and for key_concept. This is what the URL will look like: .

To retrieve the details, the api-docs page should issue a call to the already existing backend API for the details. The returned details include title, agencyId, keyConcept and endpointUrl to be used in the previously drafted message.

ronytw commented 2 years ago

I've come up with a drat implementation. I believe that the text content should be reviewed.

An alternative solution, as suggested by @ginettev , could be to have those details in-line in the Vocab Details page.