Added submit API instructions and fixed a bug in error handling for the submission validity checkers.
- Legacy-Id: 14126
This commit is contained in:
parent
3af2554b2f
commit
8d3c540edd
|
@ -80,7 +80,10 @@ def api_submit(request):
|
|||
submission = None
|
||||
def err(code, text):
|
||||
return HttpResponse(text, status=code, reason=text, content_type='text/plain')
|
||||
if request.method == 'POST':
|
||||
|
||||
if request.method == 'GET':
|
||||
return render(request, 'submit/api_submit_info.html')
|
||||
elif request.method == 'POST':
|
||||
e = None
|
||||
try:
|
||||
form = SubmissionAutoUploadForm(request, data=request.POST, files=request.FILES)
|
||||
|
@ -107,7 +110,7 @@ def api_submit(request):
|
|||
if errors:
|
||||
raise ValidationError(errors)
|
||||
|
||||
errors = [ c.message for c in submission.checks.all() if not c.passed ]
|
||||
errors = [ c.message for c in submission.checks.all() if c.passed==False ]
|
||||
if errors:
|
||||
raise ValidationError(errors)
|
||||
|
||||
|
|
50
ietf/templates/submit/api_submit_info.html
Normal file
50
ietf/templates/submit/api_submit_info.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
{% extends "base.html" %}
|
||||
{# Copyright The IETF Trust 2015, All Rights Reserved #}
|
||||
{% load origin %}
|
||||
|
||||
{% block title %}Draft submission API instructions{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% origin %}
|
||||
<h2>Draft submission API instructions</h2>
|
||||
|
||||
<p>
|
||||
A simplified draft submission interface, intended for automation,
|
||||
is available at <code>{% url 'ietf.submit.views.api_submit' %}</code>.
|
||||
</p>
|
||||
<p>
|
||||
The interface accepts only xml uploads which can be processed on the server, and
|
||||
requires the user to have a datatracker account. A successful submit still requires
|
||||
the same email confirmation roundtrip 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:
|
||||
<ul>
|
||||
<li>Only xml-only uploads are supported, not text or combined.</li>
|
||||
<li>Document replacement information cannot be supplied.</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>
|
||||
<p>
|
||||
It takes 2 parameters:
|
||||
</p>
|
||||
<ul>
|
||||
<li><code>user</code> which is the user login</li>
|
||||
<li><code>xml</code>, which is the submitted file
|
||||
</ul>
|
||||
<p>
|
||||
It returns an appropriate http result code, and a brief explanatory text message.
|
||||
</p>
|
||||
<p>
|
||||
Here is an example:</li>
|
||||
</p>
|
||||
<pre>
|
||||
$ curl -S -F "user=user.name@example.com" -F "xml=@~/draft-user-example.xml" https://datatracker.ietf.org/api/submit
|
||||
Upload of draft-user-example OK, confirmation requests sent to:
|
||||
User Name <user.name@example.com>
|
||||
</pre>
|
||||
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in a new issue