Skip to content

Commit

Permalink
Add TSV to docu (#1903)
Browse files Browse the repository at this point in the history
  • Loading branch information
dr0i committed Sep 28, 2023
1 parent ded22e8 commit 1450055
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
7 changes: 6 additions & 1 deletion app/views/api.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ <h2 id="content_types">@Messages.get("api.content_types.header") <small><a href=
<p><code>curl http://[email protected]("DE-6")</code></p>
<p>@Messages.get("api.content_types.negotiate")</p>
<p><code>curl --header "Accept: text/csv" http://[email protected]("kunst")</code></p>
<p><code>curl --header "Accept: text/tab-separated-values" http://[email protected]("kunst")</code></p>
<p><code>curl --header "Accept: application/x-jsonlines" http://[email protected]("kunst") > kunst.jsonl</code></p>
<p>@Messages.get("api.content_types.override") <a href='@routes.Application.get("DE-6", format="json")'>@routes.Application.get("DE-6", format="json")</a></p>
<p>@Messages.get("api.content_types.dotFormat") <a href='@routes.Application.getDotFormat("DE-6", format="json")'>@routes.Application.getDotFormat("DE-6", format="json")</a></p>
Expand All @@ -70,6 +71,10 @@ <h2 id="csv">@Messages.get("api.csv.header") <small><a href="#csv"><span class="
@desc(Messages.get("api.csv.default"), routes.Application.search("kunst", size=300, format="csv"))
@desc(Messages.get("api.csv.custom"), routes.Application.search("kunst", size=300, format="csv:name,isil,url,classification.label.de"))

<h2 id="csv">@Messages.get("api.tsv.header") <small><a href="#csv"><span class="glyphicon glyphicon-link"></span></a></small></h2>
@desc(Messages.get("api.tsv.default"), routes.Application.search("kunst", size=300, format="tsv"))
@desc(Messages.get("api.tsv.custom"), routes.Application.search("kunst", size=300, format="tsv:name,isil,url,classification.label.de"))

<h2 id="auto-complete">@Messages.get("api.autocomplete.header") <small><a href='#auto-complete'><span class='glyphicon glyphicon-link'></span></a></small></h2>
<p>@Messages.get("api.autocomplete.intro")</p>
@desc(Messages.get("api.autocomplete.name") + " \"format=json:name\"", routes.Application.search("name:dnb OR alternateName:dnb", format="json:name"))
Expand Down Expand Up @@ -111,4 +116,4 @@ <h2 id="openrefine">OpenRefine <small><a href="#openrefine"><span class="glyphic
<script src="https://hypothes.is/embed.js" async></script>
<link rel="canonical" href="http://lobid.org/organisations/api/@controllers.Application.currentLang()" />
@if(controllers.Application.currentLang()=="de"){<link rel="canonical" href="http://lobid.org/organisations/api/" />}
}
}
4 changes: 2 additions & 2 deletions app/views/search.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,6 @@ <h4>@Messages.get("search.location") @if(!location.isEmpty){
</div>
@defining(if(!q.isEmpty) q else "*") { qParam =>
<p>@Html(Messages.get("search.footer.api_text", routes.Application.search(q=qParam, from=from, format="json", location=location),
routes.Application.search(q=qParam, from=from, format="csv", location=location), routes.Application.api()))</p>
routes.Application.search(q=qParam, from=from, format="csv", location=location), routes.Application.search(q=qParam, from=from, format="tsv", location=location), routes.Application.api()))</p>
}} else { @if(!q.isEmpty) {<p class='footer'>@Html(Messages.get("search.footer.no_results", q))</p>} } }
}}
}}
1 change: 1 addition & 0 deletions conf/dataset.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"documentation": "http://lobid.org/organisations/api",
"encodingFormat": [
"text/csv",
"text/tab-separated-values",
"application/json",
"application/ld+json"
],
Expand Down
8 changes: 6 additions & 2 deletions conf/messages.de
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ search.location = Standort
search.prev = vorige
search.next = nächste
search.total_results = Trefferzahl
search.footer.api_text = Sie können auf diese Daten auch als <a href="{0}">JSON</a> oder <a href="{1}">CSV</a> über unsere <a href="{2}">Programmierschnittstelle</a> zugreifen.
search.footer.api_text = Sie können auf diese Daten auch als <a href="{0}">JSON</a> oder <a href="{1}">CSV</a> (resp. TSV <a href="{2}">TSV</a>) über unsere <a href="{3}">Programmierschnittstelle</a> zugreifen.
search.footer.no_results = Keine Ergebnisse für <code>{0}</code>.
search.type = Typ
search.collects = Bestandsgröße
Expand All @@ -64,7 +64,7 @@ api.location.distance = Suche über Distanz zu einem Punkt ("location": Koordina

api.content_types.header = Inhaltstypen
api.content_types.default = Standardmäßig liefert dieser Dienst strukturierte API-Antworten (als JSON):
api.content_types.negotiate = Er unterstützt Content-Negotiation über den Accept-Header für JSON (application/json), CSV (text/csv), JSON lines (application/x-jsonlines) oder HTML (text/html):
api.content_types.negotiate = Er unterstützt Content-Negotiation über den Accept-Header für JSON (application/json), CSV (text/csv), TSV (text/tab-separated-values), JSON lines (application/x-jsonlines) oder HTML (text/html):
api.content_types.override = Der Query-Parameter "format" kann verwendet werden, um den Accept-Header aufzuheben, z.B. zur Anzeige von JSON im Browser:
api.content_types.dotFormat = Der Wert des Format-Parameters kann für Einzeltreffer auch in URLs als Dateiendung verwendet werden:
api.content_types.compress = Für größere Anfragen kann die Antwort als gzip komprimiert werden:
Expand All @@ -74,6 +74,10 @@ api.csv.header = CSV-Export
api.csv.default = Standardfelder ("format=csv")
api.csv.custom = Benutzerdefinierte Felder ("format": zu verwendende Felder, mit Punkten für geschachtelte Felder im Format "csv:feld1,feld2.unterfeld")

api.tsv.header = TSV-Export
api.tsv.default = Standardfelder ("format=tsv")
api.tsv.custom = Benutzerdefinierte Felder ("format": zu verwendende Felder, mit Punkten für geschachtelte Felder im Format "tsv:feld1,feld2.unterfeld")

api.autocomplete.header = Autovervollständigung
api.autocomplete.intro = Die API unterstützt ein spezielles Antwortformat mit Vorschlägen zur Vervollständigung aus einem angegebenen Feld:
api.autocomplete.name = Name vorschlagen:
Expand Down
8 changes: 6 additions & 2 deletions conf/messages.en
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ search.location = Location
search.prev = prev
search.next = next
search.total_results = Total results
search.footer.api_text = You can also access this data as <a href="{0}">JSON</a> or <a href="{1}">CSV</a> using our <a href="{2}">API</a>.
search.footer.api_text = You can also access this data as <a href="{0}">JSON</a> or <a href="{1}">CSV</a> (resp. <a href="{2}">TSV</a>) using our <a href="{3}">API</a>.
search.footer.no_results = No results for <code>{0}</code>.
search.type = Type
search.collects = Stock size
Expand All @@ -64,7 +64,7 @@ api.location.distance = Query with distance ("location": coordinate of a point a

api.content_types.header = Content types
api.content_types.default = By default, this service returns structured API responses (as JSON):
api.content_types.negotiate = It supports content negotiation based on the "Accept" header to serve JSON (application/json), CSV (text/csv), JSON lines (application/x-jsonlines), or HTML (text/html):
api.content_types.negotiate = It supports content negotiation based on the "Accept" header to serve JSON (application/json), CSV (text/csv), TSV (text/tab-separated-values), JSON lines (application/x-jsonlines), or HTML (text/html):
api.content_types.override = An optional "format" query parameter can be used to override the "Accept" header, e.g. to display JSON in a browser:
api.content_types.dotFormat = For individual organisations, the format parameter values can be used as file extensions in URLs:
api.content_types.compress = For larger requests, the response can be compressed as gzip:
Expand All @@ -74,6 +74,10 @@ api.csv.header = CSV export
api.csv.default = Default fields ("format=csv")
api.csv.custom = Custom fields ("format": fields to use, with dots for nested fields "csv:field1,field2.subfield")

api.tsv.header = TSV export
api.tsv.default = Default fields ("format=tsv")
api.tsv.custom = Custom fields ("format": fields to use, with dots for nested fields "tsv:field1,field2.subfield")

api.autocomplete.header = Auto-complete
api.autocomplete.intro = The API supports a response format for auto-complete suggestions using a specified field:
api.autocomplete.name = Suggest name:
Expand Down

0 comments on commit 1450055

Please sign in to comment.