Skip to content

Commit

Permalink
Link to Datasette API docs from /-/api, refs #1871
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Nov 2, 2022
1 parent 042881a commit 000eeb4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions datasette/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,7 @@ async def menu_links():
),
"base_url": self.setting("base_url"),
"csrftoken": request.scope["csrftoken"] if request else lambda: "",
"datasette_version": __version__,
},
**extra_template_vars,
}
Expand Down
15 changes: 7 additions & 8 deletions datasette/templates/api_explorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@

<h1>API Explorer</h1>

<p>Use this tool to try out the Datasette write API.</p>

{% if errors %}
{% for error in errors %}
<p class="message-error">{{ error }}</p>
{% endfor %}
{% endif %}

<p>Use this tool to try out the
{% if datasette_version %}
<a href="https://docs.datasette.io/en/{{ datasette_version }}/json_api.html">Datasette API</a>.
{% else %}
Datasette API.
{% endif %}
</p>
<details open style="border: 2px solid #ccc; border-bottom: none; padding: 0.5em">
<summary style="cursor: pointer;">GET</summary>
<form method="get" id="api-explorer-get" style="margin-top: 0.7em">
Expand Down
1 change: 0 additions & 1 deletion datasette/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,6 @@ async def get(self, request):
if key not in ("_labels", "_facet", "_size")
]
+ [("_size", "max")],
"datasette_version": __version__,
"settings": self.ds.settings_dict(),
},
}
Expand Down

0 comments on commit 000eeb4

Please sign in to comment.