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

Flow of REST request between Emikat and CSIS #5

Closed
patrickkaleta opened this issue May 20, 2019 · 9 comments
Closed

Flow of REST request between Emikat and CSIS #5

patrickkaleta opened this issue May 20, 2019 · 9 comments
Assignees
Labels
BB: Catalogue of ER & AO Catalogue of Elements at Risk and Adaptation Options Building Block enhancement New feature or request help wanted Extra attention is needed

Comments

@patrickkaleta
Copy link
Contributor

patrickkaleta commented May 20, 2019

Overview

In this issue we will describe the flow of individual REST calls between Emikat and CSIS, how to access the endpoints on Drupal-side and what content(-fields) should be expected in each response.

General procedure

  1. CSIS needs to trigger Emikat (send all necessary information and receive Emikat's internal ID of our Study) once a new Study is created and sufficient data has been added, so that Emikat can start the calculations. TODO: We need to define how much data is "sufficient" here: Configuring initial Study trigger #6.
  2. Emikat requests the data it needs from the Drupal REST endpoint (going to be either special views or the complete nodes exported as json or hal_json)
  3. Emikat needs to trigger Drupal once results are available and Drupal needs to trigger Emikat once changes to the Study are made.

Individual REST endpoints

1) Initial Study information

Link: csis.myclimateservice.eu/rest/emikat/study/[StudyID]
This link will be given to Emikat in the initial trigger event from the CSIS. BasicAuth is used as authentication. Emikat can use the "Emikat" user in the CSIS, which was created for this purpose.
This endpoint uses the REST Group View and displays the following properties:

  • study_title: Name of the Study
  • study_description: Description of the Study
  • study_area_left: position of the left side of the bounding box
  • study_area_top: position of the top side of the bounding box
  • study_area_right: position of the right side of the bounding box
  • study_area_bottom: position of the bottom side of the bounding box
  • path_data_package: Link to the endpoint with additional information about the used data package
  • path_resources: Link to View endpoint showing all resources in that Study/datapackage

2) Data package information

Link: csis.myclimateservice.eu/node/[DatapackageID]?_format=hal_json
This endpoint is currently not implemented as a view, so the complete data package is displayed. This can be changed if necessary, so that only relevant fields are displayed.

3) Resources information

Link: csis.myclimateservice.eu/rest/emikat/dp[DatapackageID]/resources
This endpoint uses the REST Node View and displays the following properties:

  • resource_description: Description of resource (plain text)
  • resource_format: format of resource (Geojson, jpeg, Shapefile, ...)
  • resource_url: array of URLs to external source(s) of resource

additional REST endpoints ???

@patrickkaleta patrickkaleta added enhancement New feature or request help wanted Extra attention is needed labels May 20, 2019
@patrickkaleta
Copy link
Contributor Author

@humerh
since we don't have the initial trigger yet and there is only one study available, you can test this by using this URL: https://csis.myclimateservice.eu/rest/emikat/study/1

If you need additional fields (or would like to rename some of the fields or use different formats e.g. for the study_area) in one of the endpoints or complete new endpoints, please write them as comments here in this issue.

@patrickkaleta
Copy link
Contributor Author

@humerh as was just discussed I changed the study_area field in the response body, so that it now shows to coordinates for left, top, right and bottom. For that I had to split the original field into 4 new fields.

@humerh
Copy link

humerh commented May 20, 2019

@patrickkaleta additionally I need the list of ressources in the data package.
For each ressource I need at least following fields:

  • description
  • format
  • url

@patrickkaleta
Copy link
Contributor Author

@patrickkaleta additionally I need the list of ressources in the data package.
For each ressource I need at least following fields:

  • description
  • format
  • url

I created a new REST endpoint (accessible by the Emikat-user in the CSIS) at the following URL-pattern: .../rest/emikat/dp/[DatapackageID]/resources
@humerh That link is now included in the "Initial Study information" endpoint (described on top in the first comment), so Emikat should have no trouble getting to it.

@maesbri
Copy link

maesbri commented Jun 6, 2019

@humerh be aware that in the data package resources, the "path" property can be either a url or an array of urls

@patrickkaleta
Copy link
Contributor Author

@humerh be aware that in the data package resources, the "path" property can be either a url or an array of urls

Interesting! In that case I believe that the path field in Drupal should be allowed to contain unlimited values and not just one.
@fgeyer16 since we already have data in that field, can we change the settings from "limited to 1" to "unlimited" without running into problems?

@fgeyer16
Copy link

fgeyer16 commented Jun 6, 2019

@fgeyer16 since we already have data in that field, can we change the settings from "limited to 1" to "unlimited" without running into problems?

As far as I experienced making a single value field to a multi value works and does not cause problems. Only the other direction does not work

@patrickkaleta
Copy link
Contributor Author

@fgeyer16 since we already have data in that field, can we change the settings from "limited to 1" to "unlimited" without running into problems?

As far as I experienced making a single value field to a multi value works and does not cause problems. Only the other direction does not work

That was also my believe. I tested changing the field's cardinality locally and it worked without problems. I will now apply this in the CSIS.

@p-a-s-c-a-l p-a-s-c-a-l added this to the D1.4 CLARITY CSIS v2 milestone Jun 24, 2019
@p-a-s-c-a-l p-a-s-c-a-l added the BB: Catalogue of ER & AO Catalogue of Elements at Risk and Adaptation Options Building Block label Jul 1, 2019
@p-a-s-c-a-l p-a-s-c-a-l added this to To do in T1.3 Climate Services Co-creation via automation Jul 1, 2019
@patrickkaleta patrickkaleta pinned this issue Oct 14, 2019
@patrickkaleta
Copy link
Contributor Author

Closing this, since basic communication between Emikat and Drupal is already implemented by now and working. For reference purposes I'll keep this issue pinned to the top.

T1.3 Climate Services Co-creation automation moved this from Backlog: High Priority to Done Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BB: Catalogue of ER & AO Catalogue of Elements at Risk and Adaptation Options Building Block enhancement New feature or request help wanted Extra attention is needed
Projects
No open projects
Development

No branches or pull requests

5 participants