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

Add http-api endpoint to add datasets from scenario topic to scenario-bundles scenarios #1890

Open
1 task done
jh-RLI opened this issue Oct 14, 2024 · 0 comments · May be fixed by #1894
Open
1 task done

Add http-api endpoint to add datasets from scenario topic to scenario-bundles scenarios #1890

jh-RLI opened this issue Oct 14, 2024 · 0 comments · May be fixed by #1894
Assignees
Labels
enhancement oekg Scenario Bundle Feature of the oeplatform. Urgency-M urgency level: medium

Comments

@jh-RLI
Copy link
Contributor

jh-RLI commented Oct 14, 2024

Description of the issue

Currently, it is not possible to simply interact with the scenario bundles using http requests. Django requires users to send a CSRF token that is used to verify user actions done via a interface while the user is logged in.

To implement an actual WEB-API that enables users to manage scenario bundles using programmatic approaches, we need to create HTTP-api endpoints that enable the user to use the API token to send form data to the oeplatform.

Ideas of solution

Implement an api endpoint that enables http requests and requires a user token (users must be logged in).

There are several functions to open up like creating / editing bundles. To start of this issue is concerned with enabling users to add a single or a list of datasets from the scenario topic on the oeplatform to a specific scenario that is part of a specific scenario bundle.

We will implement an endpoint called "/api/v0/scenario-bundle/scenario/manage-datasets/".

This endpoint uses the unique UUID from a scenario to avoid complex sparql queries that retrieve the scenario. The user will be able to copy this scenario ID from the scenario bundle page that lists the scenarios. The table name is already unique and can be copied. Here we need the technical table name, not the title from the metadata.

AS we send an HTTP requests, we can specify the payload and send data to the oeplatform. I propose that the payload will have the following structure:

payload = {"scenario": "UUID", "dataset": [{"name":"table-name1", "type": "input|output"}, {"name":"table-name2", "type": "input|output"}]}

The request should be a post request type and the header must contain the token for authentication.

Using a delete request will remove the selection available in the payload.

Workflow checklist

@jh-RLI jh-RLI self-assigned this Oct 14, 2024
@jh-RLI jh-RLI added Scenario Bundle Feature of the oeplatform. oekg labels Oct 14, 2024
@jh-RLI jh-RLI moved this to OEPlatform Todo in factsheets + scenario bundles Oct 14, 2024
@jh-RLI jh-RLI added the Urgency-M urgency level: medium label Oct 14, 2024
jh-RLI added a commit that referenced this issue Oct 21, 2024
jh-RLI added a commit that referenced this issue Oct 21, 2024
…ets #1890

(remove would be part of the delete method).
jh-RLI added a commit that referenced this issue Oct 21, 2024
jh-RLI added a commit that referenced this issue Oct 21, 2024
@jh-RLI jh-RLI linked a pull request Oct 21, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement oekg Scenario Bundle Feature of the oeplatform. Urgency-M urgency level: medium
Projects
Status: OEPlatform Todo
Development

Successfully merging a pull request may close this issue.

1 participant