forked from ietf-tools/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_submission_info.html
More file actions
106 lines (104 loc) · 3.96 KB
/
Copy pathapi_submission_info.html
File metadata and controls
106 lines (104 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{% extends "base.html" %}
{# Copyright The IETF Trust 2015-2022, All Rights Reserved #}
{% load origin ietf_filters %}
{% block title %}I-D submission API instructions{% endblock %}
{% block content %}
{% origin %}
<h1 class="mb-3">Internet-Draft submission API instructions</h1>
<p>
A simplified Internet-Draft submission interface, intended for automation,
is available at <code>{% url 'ietf.submit.views.api_submission' %}</code>.
</p>
<p>
The interface accepts only XML uploads that can be processed on the server, and
requires the user to have a datatracker account. A successful submit still requires
the same email confirmation round-trip as submissions done through the regular
<a href="{% url 'ietf.submit.views.upload_submission' %}">submission tool</a>.
</p>
<p>
This interface does not provide all the options which the regular submission tool does.
Some limitations:
</p>
<ul>
<li>Only XML-only uploads are supported, not text or combined.</li>
<li>
The server expects <code>multipart/form-data</code>, supported by <code>curl</code> but <b>not</b> by <code>wget</code>.
</li>
</ul>
<p>
It takes the following parameters:
</p>
<ul>
<li>
<code>user</code> which is the user login (required)
</li>
<li>
<code>xml</code>, which is the submitted file (required)
</li>
<li>
<code>replaces</code>, a comma-separated list of Internet-Draft names replaced by this submission (optional)
</li>
</ul>
<p>
When an Internet-Draft is submitted, basic checks are performed immediately and an HTTP response
is sent including an appropriate http result code and JSON data describing the outcome.
</p>
<p>
On success, the JSON data format is
</p>
<pre class="border p-3 mb-3">
{
"id": "123",
"name": "draft-just-submitted",
"rev": "00",
"status_url": "{% absurl 'ietf.submit.views.api_submission_status' submission_id='123' %}"
}</pre>
<p>
On error, the JSON data format is
</p>
<pre class="border p-3 mb-3">
{
"error": "Description of the error"
}</pre>
<p>
If the basic checks passed and a successful response is sent, the Internet-Draft is queued for further
processing. Its status can be monitored by issuing GET requests to the <code>status_url</code>
indicated in the JSON response. This URL will respond with JSON data in the format
</p>
<pre class="border p-3 mb-3">
{
"id": "123",
"state": "validating"
}</pre>
<p>
The state <code>validating</code> indicates that the Internet-Draft is being or waiting to be processed.
Any other state indicates that the Internet-Draft completed validation. If the validation failed or if the
Internet-Draft was canceled after validation, the state will be <code>cancel</code>.
</p>
<p>
Human-readable details of the Internet-Draft's status and history can be found at
{% absurl 'ietf.submit.views.submission_status' submission_id='123' %}
(replacing <code>123</code> with the <code>id</code> for the submission).)
</p>
<p>
Here is an example of submitting an Internet-Draft and polling its status through the API:
</p>
<pre class="border p-3">
$ curl -s -F "user=user.name@example.com" -F "xml=@~/draft-user-example.xml" -F "replaces=draft-user-replaced-draft" {% absurl 'ietf.submit.views.api_submission' %} | jq
{
"id": "126375",
"name": "draft-user-example",
"rev": "00",
"status_url": "{% absurl 'ietf.submit.views.api_submission_status' submission_id='126375' %}"
}
$ curl -s {% absurl 'ietf.submit.views.api_submission_status' submission_id='126375' %} | jq
{
"id": "126375",
"state": "validating"
}
$ curl -s {% absurl 'ietf.submit.views.api_submission_status' submission_id='126375' %} | jq
{
"id": "126375",
"state": "auth"
}</pre>
{% endblock %}