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:
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