Skip to content

Commit 8d3c540

Browse files
committed
Added submit API instructions and fixed a bug in error handling for the submission validity checkers.
- Legacy-Id: 14126
1 parent 3af2554 commit 8d3c540

2 files changed

Lines changed: 55 additions & 2 deletions

File tree

ietf/submit/views.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ def api_submit(request):
8080
submission = None
8181
def err(code, text):
8282
return HttpResponse(text, status=code, reason=text, content_type='text/plain')
83-
if request.method == 'POST':
83+
84+
if request.method == 'GET':
85+
return render(request, 'submit/api_submit_info.html')
86+
elif request.method == 'POST':
8487
e = None
8588
try:
8689
form = SubmissionAutoUploadForm(request, data=request.POST, files=request.FILES)
@@ -107,7 +110,7 @@ def err(code, text):
107110
if errors:
108111
raise ValidationError(errors)
109112

110-
errors = [ c.message for c in submission.checks.all() if not c.passed ]
113+
errors = [ c.message for c in submission.checks.all() if c.passed==False ]
111114
if errors:
112115
raise ValidationError(errors)
113116

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{% extends "base.html" %}
2+
{# Copyright The IETF Trust 2015, All Rights Reserved #}
3+
{% load origin %}
4+
5+
{% block title %}Draft submission API instructions{% endblock %}
6+
7+
{% block content %}
8+
{% origin %}
9+
<h2>Draft submission API instructions</h2>
10+
11+
<p>
12+
A simplified draft submission interface, intended for automation,
13+
is available at <code>{% url 'ietf.submit.views.api_submit' %}</code>.
14+
</p>
15+
<p>
16+
The interface accepts only xml uploads which can be processed on the server, and
17+
requires the user to have a datatracker account. A successful submit still requires
18+
the same email confirmation roundtrip as submissions done through the regular
19+
<a href="{% url 'ietf.submit.views.upload_submission' %}">submission tool</a>.
20+
</p>
21+
<p>
22+
This interface does not provide all the options which the regular submission tool does.
23+
Some limitations:
24+
<ul>
25+
<li>Only xml-only uploads are supported, not text or combined.</li>
26+
<li>Document replacement information cannot be supplied.</li>
27+
<li>The server expects <code>multipart/form-data</code>, supported by <code>curl</code> but <b>not</b> by <code>wget</code></li>
28+
</ul>
29+
</p>
30+
<p>
31+
It takes 2 parameters:
32+
</p>
33+
<ul>
34+
<li><code>user</code> which is the user login</li>
35+
<li><code>xml</code>, which is the submitted file
36+
</ul>
37+
<p>
38+
It returns an appropriate http result code, and a brief explanatory text message.
39+
</p>
40+
<p>
41+
Here is an example:</li>
42+
</p>
43+
<pre>
44+
$ curl -S -F "user=user.name@example.com" -F "xml=@~/draft-user-example.xml" https://datatracker.ietf.org/api/submit
45+
Upload of draft-user-example OK, confirmation requests sent to:
46+
User Name &lt;user.name@example.com&gt;
47+
</pre>
48+
49+
50+
{% endblock %}

0 commit comments

Comments
 (0)