diff --git a/templates/zerver/api/index.md b/templates/zerver/api/index.md
index 3f39eda357..5cf9c14cd0 100644
--- a/templates/zerver/api/index.md
+++ b/templates/zerver/api/index.md
@@ -1,6 +1,6 @@
# We hear you like APIs...
-We have a [well-documented API](/api/endpoints) that allows you to build
+We have a [well-documented API](/api) that allows you to build
custom integrations, in addition to our [existing integrations](/integrations).
For ease-of-use, we've created a Python module that you can drop in to a
project to start interacting with our API. There is also a
diff --git a/templates/zerver/api/private-message.md b/templates/zerver/api/private-message.md
index 576da7d7b6..8582b8ab15 100644
--- a/templates/zerver/api/private-message.md
+++ b/templates/zerver/api/private-message.md
@@ -59,7 +59,7 @@ zulip-send hamlet@example.com \
You can omit the `user` and `api-key` arguments if you have a `~/.zuliprc` file.
-See also the [full API endpoint documentation](/api/endpoints).
+See also the [full API endpoint documentation](/api).
diff --git a/templates/zerver/api/stream-message.md b/templates/zerver/api/stream-message.md
index 7f6758e5ef..95fecef600 100644
--- a/templates/zerver/api/stream-message.md
+++ b/templates/zerver/api/stream-message.md
@@ -73,7 +73,7 @@ zulip-send --stream Denmark --subject Castle \
You can omit the `user` and `api-key` arguments if you have a `~/.zuliprc` file.
-See also the [full API endpoint documentation](/api/endpoints).
+See also the [full API endpoint documentation](/api).
diff --git a/templates/zerver/api_content.json b/templates/zerver/api_content.json
deleted file mode 100644
index 5580708417..0000000000
--- a/templates/zerver/api_content.json
+++ /dev/null
@@ -1,146 +0,0 @@
-[
- {
- "method": "POST",
- "endpoint": "messages",
- "example_response": "{'msg': '', 'result': 'success', 'id': 12345678}",
- "returns": [
- [
- "id",
- "The ID of the newly created message."
- ]
- ],
- "call": "Send a message",
- "arguments": [
- [
- "type",
- "One of {private, stream}"
- ],
- [
- "content",
- "The content of the message. Maximum message size of 10000 bytes."
- ],
- [
- "to",
- "In the case of a stream message, a string identifying the stream. In the case of a private message, a JSON-encoded list containing the usernames of the recipients."
- ],
- [
- "subject",
- "The topic for the message (Only required if type is \u201cstream\u201d). Maximum length of 60 characters."
- ]
- ],
- "example_request": {
- "python": "
\nclient.send_message({\n \"type\": \"private\",\n \"to\": \"wdaher@example.com\",\n \"content\": \"I come not, friends, to steal away your hearts.\"\n})\nclient.send_message({\n \"type\": \"stream\",\n \"to\": \"Denmark\",\n \"subject\": \"Castle\",\n \"content\": \"Something is rotten in the state of Denmark.\"\n})\n
\n",
- "curl": "
Stream message
\n
curl https://zulip.example.com/api/v1/messages \\\n -u BOT_EMAIL_ADDRESS:BOT_API_KEY \\\n -d \"type=stream\" \\\n -d \"to=Denmark\" \\\n -d \"subject=Castle\" \\\n -d \"content=Something is rotten in the state of Denmark.\"\n
\n
Private message
\n
curl https://zulip.example.com/api/v1/messages \\\n -u BOT_EMAIL_ADDRESS:BOT_API_KEY \\\n -d \"type=private\" \\\n -d \"to=othello@example.com\" \\\n -d \"content=I come not, friends, to steal away your hearts.\"\n
"
- }
- },
- {
- "method": "POST",
- "endpoint": "register",
- "example_response": "{'msg': '', 'last_event_id': -1, 'result': 'success', 'queue_id': '1375801870:2942'}",
- "returns": [
- [
- "queue_id",
- "The ID of the queue that has been allocated for your client"
- ],
- [
- "last_event_id",
- "The initial value of the `last_event_id` value for to pass to `GET /api/v1/events`."
- ]
- ],
- "call": "Register a queue to receive new messages",
- "arguments": [
- [
- "event_types",
- "(optional) A JSON-encoded array indicating which types of events you're interested in. Values that you might find useful include:
- message (messages),
- subscriptions (changes in your subscriptions),
- realm_user (changes in the list of users in your realm), and
- pointer (changes in your pointer).
\n If you do not specify this argument, you will receive all events, and have to filter out the events not relevant to your client in your client code. For most applications, one is only interested in messages, so one specifies:
event_types=[\"message\"]"
- ],
- [
- "apply_markdown",
- "(optional) set to \u201ctrue\u201d if you would like the content to be rendered in HTML format (by default, the API returns the raw text that the user entered)"
- ]
- ],
- "example_request": {
- "python": "
",
- "curl": "
curl https://zulip.example.com/api/v1/register \\\n -u othello-bot@example.com:a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \\\n -d 'event_types=[\"message\"]'\n
"
- }
- },
- {
- "method": "GET",
- "endpoint": "events",
- "example_response":
-"{'result': 'success',
- 'msg': '',
- 'events': [
- {'type': 'message',
- 'id': 0,
- 'message': {
- 'content_type': 'text/x-markdown',
- 'avatar_url': 'https://url/for/othello-bots/avatar',
- 'timestamp': 1375978403,
- 'display_recipient': 'Denmark',
- 'sender_id': 13215,
- 'sender_full_name': 'Othello Bot',
- 'sender_email': 'othello-bot@example.com',
- 'sender_short_name': 'othello-bot',
- 'sender_realm_str': 'example',
- 'content': 'Something is rotten in the state of Denmark.',
- 'recipient_id': 12314,
- 'client': 'website',
- 'subject_links': [],
- 'subject': 'Castle',
- 'type': 'stream',
- 'id': 12345678,
- }
- },
- {'type': 'message',
- 'id': 1,
- 'message': {
- 'content_type': 'text/x-markdown',
- 'avatar_url': 'https://url/for/othello-bots/avatar',
- 'timestamp': 1375978404,
- 'display_recipient': [{'full_name': 'Hamlet of Denmark',
- 'email': 'hamlet@example.com',
- 'short_name': 'hamlet',
- 'id': 31572}],
- 'sender_id': 13215,
- 'sender_full_name': 'Othello Bot',
- 'sender_email': 'othello-bot@example.com',
- 'sender_short_name': 'othello-bot',
- 'sender_realm_str': 'example',
- 'content': 'I come not, friends, to steal away your hearts.',
- 'recipient_id': 18391,
- 'client': 'website',
- 'subject_links': [],
- 'subject': '',
- 'type': 'private',
- 'id': 12345679,
- }
- }
- ]
-}",
- "returns": [
- [
- "events",
- "an array (possibly zero-length if dont_block is set) of events with IDs newer than `last_event_id`. Event IDs are guaranted to be increasing, but they are not guaranteed to be consecutive."
- ]
- ],
- "call": "Get new events from an events queue",
- "arguments": [
- [
- "queue_id",
- "The ID of a queue that you registered via
POST /api/v1/register
"
- ],
- [
- "last_event_id",
- "The highest event ID in this queue that you've received and wish to acknowledge. See the code for
call_on_each_event in the
zulip Python module for an example implementation of correctly processing each event exactly once."
- ],
- [
- "dont_block",
- "(optional) set to \u201ctrue\u201d if the client is requesting a nonblocking reply. If not specified, the request will block until either a new event is available or a few minutes have passed, in which case the server will send the client a heartbeat event."
- ]
- ],
- "example_request": {
- "python": "
or if you want the event queues managed for you,
client.call_on_each_event()\n
",
- "curl": "
curl -G https://zulip.example.com/api/v1/events \\\n -u othello-bot@example.com:a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5 \\\n -d \"queue_id=1375801870:2942\" \\\n -d \"last_event_id=-1\"\n
"
- }
- }
-]
diff --git a/templates/zerver/api_endpoints.html b/templates/zerver/api_endpoints.html
deleted file mode 100644
index d6d90705d5..0000000000
--- a/templates/zerver/api_endpoints.html
+++ /dev/null
@@ -1,69 +0,0 @@
-{% extends "zerver/portico.html" %}
-
-{# API information page #}
-
-{% block customhead %}
-{{ super() }}
-{% endblock %}
-
-{% block portico_content %}
-
-
-
In addition to our pre-built API bindings for
- Python, we also have
- a REST-ful
- web API.
-
-
-
- {% autoescape off %}
- {% for blurb in content %}
-
-
{{ blurb.call }}
-
{{blurb.method}} {{ blurb.endpoint }}
-
-
Arguments
-
- {% for argument in blurb.arguments %}
- {{ argument.0 }}
- - {{ argument.1 }}
- {% endfor %}
-
-
-
Return values
-
- {% for return in blurb.returns %}
- {{ return.0 }}
- - {{ return.1 }}
- {% endfor %}
-
-
- {% if blurb.example_request %}
-
Example request
- {% for lang, req in blurb.example_request.items() %}
-
- {{ req }}
-
- {% endfor %}
- {% endif %}
-
- {% if blurb.rendered_response %}
-
Example response
-
- {{ blurb.rendered_response }}
-
- {% endif %}
-
-
- {% endfor %}
- {% endautoescape %}
-
-{% endblock %}
diff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.py
index c484c4135c..db5b3c15b7 100644
--- a/zerver/tests/test_docs.py
+++ b/zerver/tests/test_docs.py
@@ -52,7 +52,6 @@ class DocPageTest(ZulipTestCase):
@slow("Tests dozens of endpoints, including generating lots of emails")
def test_doc_endpoints(self) -> None:
self._test('/api/', 'We hear you like APIs')
- self._test('/api/endpoints/', 'pre-built API bindings for')
self._test('/api/api-keys', 'you can use its email and API key')
self._test('/api/installation-instructions', 'No download required!')
self._test('/api/private-message', 'steal away your hearts')
diff --git a/zerver/views/integrations.py b/zerver/views/integrations.py
index f3d599ac01..8020e815c5 100644
--- a/zerver/views/integrations.py
+++ b/zerver/views/integrations.py
@@ -152,33 +152,3 @@ def integration_doc(request: HttpRequest, integration_name: str=REQ(default=None
doc_html_str = render_markdown_path(integration.doc, context)
return HttpResponse(doc_html_str)
-
-def api_endpoint_docs(request: HttpRequest) -> HttpResponse:
- context = {} # type: Dict[str, Any]
- add_api_uri_context(context, request)
-
- raw_calls = open('templates/zerver/api_content.json', 'r').read()
- calls = ujson.loads(raw_calls)
- langs = set()
- for call in calls:
- call["endpoint"] = "%s/v1/%s" % (
- context["api_url"],
- call["endpoint"])
- call["example_request"]["curl"] = call["example_request"]["curl"].replace(
- "https://api.zulip.com",
- context["api_url"])
- response = call['example_response']
- if '\n' not in response:
- # For 1-line responses, pretty-print them
- extended_response = response.replace(", ", ",\n ")
- else:
- extended_response = response
- call['rendered_response'] = bugdown.convert("~~~ .py\n" + extended_response + "\n~~~\n")
- for example_type in ('request', 'response'):
- for lang in call.get('example_' + example_type, []):
- langs.add(lang)
- return render(
- request,
- 'zerver/api_endpoints.html',
- context={'content': calls, 'langs': langs},
- )
diff --git a/zproject/urls.py b/zproject/urls.py
index 67bddd5309..636cdc6ddb 100644
--- a/zproject/urls.py
+++ b/zproject/urls.py
@@ -447,9 +447,6 @@ i18n_urls = [
name='zerver.views.registration.accounts_home_from_multiuse_invite'),
# API and integrations documentation
-
- url(r'^api/endpoints/$', zerver.views.integrations.api_endpoint_docs,
- name='zerver.views.integrations.api_endpoint_docs'),
url(r'^integrations/doc-html/(?P
[^/]*)$',
zerver.views.integrations.integration_doc,
name="zerver.views.integrations.integration_doc"),