Skip to content

Commit

Permalink
Use trailing slash as default for gnd/reconcile/ route
Browse files Browse the repository at this point in the history
- Allows usage of relative links both in `reconcile` subdomain
deployment as well as in lobid.org/gnd/reconcile/ deployment
- Switch back to the `@desc` block for query and extend GET sample
  • Loading branch information
fsteeg committed Sep 13, 2024
1 parent 98bfb35 commit c1b0f6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
10 changes: 5 additions & 5 deletions app/views/reconcile.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

@()

@desc(label: String, link: play.api.mvc.Call) = {
@desc(label: String, call: play.api.mvc.Call) = {
@defining(call.toString.replace("/gnd/reconcile/", "")) { link =>
<dt>@Html(label)</dt> <dd><a href='@link'>@java.net.URLDecoder.decode(link.toString.replaceAll("[&?]format=json$", ""), "UTF-8")</a></dd>
}
}

@gnd("GND Reconciliation") {
Expand Down Expand Up @@ -62,8 +64,7 @@ <h3>View-API</h3>

<h3>Query-API <small>(<a href="https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410/#reconciliation-queries">spec</a>)</small></h3>

<p><b>Query: GET</b><br/>
<a href='@controllers.HomeController.config("host")/?queries={"q1":{"query":"Twain, Mark"}}'>/?queries={"q1":{"query":"Twain, Mark"}}</a>
@desc("Query: GET", routes.Reconcile.main(queries="{\"q1\":{\"query\":\"Twain, Mark\"}}"))
<p><b>Query: POST</b><br/>
<code>curl --data 'queries={"q1":{"query":"Twain, Mark"}}' @controllers.HomeController.config("host")</code></p>

Expand All @@ -79,8 +80,7 @@ <h3>Suggest-API <small>(<a href="https://www.w3.org/community/reports/reconcilia
<h3>Data-extension-API</h3>

@desc("Property-proposals (<a href=\"https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410/#data-extension-property-proposals\">spec</a>)", routes.Reconcile.properties("","Work",""))
<p><b>Query: GET (<a href=\"https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410/#data-extension-service\">spec</a>)</b><br/>
<a href='@controllers.HomeController.config("host")/?extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]}'>/?extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]}</a>
@desc("Extend: GET (<a href=\"https://www.w3.org/community/reports/reconciliation/CG-FINAL-specs-0.2-20230410/#data-extension-service\">spec</a>)", routes.Reconcile.main(extend="{\"ids\":[\"1081942517\",\"4791358-7\"],\"properties\":[{\"id\":\"preferredName\"},{\"id\":\"firstAuthor\"}]}"))
<p><b>Extend: POST</b><br/>
<code>curl --data 'extend={"ids":["1081942517","4791358-7"],"properties":[{"id":"preferredName"},{"id":"firstAuthor"}]}' @controllers.HomeController.config("host")</code></p>

Expand Down
13 changes: 6 additions & 7 deletions conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
# This file defines all application routes (Higher priority routes first)
# ~~~~

# Handle trailing slashes
GET /gnd/reconcile/ controllers.Reconcile.main(callback ?= "", queries ?= "", extend ?= "")
POST /gnd/reconcile/ controllers.Reconcile.reconcile()
GET /*path/ controllers.HomeController.redirectSlash(path: String)

#OpenRefine reconciliation endpoint
GET /gnd/reconcile controllers.Reconcile.main(callback ?= "", queries ?= "", extend ?= "")
POST /gnd/reconcile controllers.Reconcile.reconcile()
GET /gnd/reconcile controllers.Default.redirect(to = "/gnd/reconcile/")
GET /gnd/reconcile/ controllers.Reconcile.main(callback ?= "", queries ?= "", extend ?= "")
POST /gnd/reconcile/ controllers.Reconcile.reconcile()
GET /gnd/reconcile/properties controllers.Reconcile.properties(callback ?= "", type ?= "", limit ?= "")
GET /gnd/reconcile/suggest/:service controllers.Reconcile.suggest(callback ?= "", service, prefix, type ?= "", type_strict ?= "", limit: Int ?= 10, start: Int ?= 0)
GET /gnd/reconcile/flyout/:service controllers.Reconcile.flyout(callback ?= "", service, id)

# Handle trailing slashes
GET /*path/ controllers.HomeController.redirectSlash(path: String)

GET /gnd controllers.HomeController.index

GET /gnd/api controllers.HomeController.api
Expand Down

0 comments on commit c1b0f6d

Please sign in to comment.