{% extends "test_app/base.html" %} {% block page_header %} Django Feature Release v5.0 - API Send {% endblock page_header %} {% block page_subheader %} API Send Page {% endblock page_subheader %} {% block stylesheets %} {% endblock stylesheets %} {% block content %}

Use this to generate and send test API requests to other projects.

API Send Form

Use the below form to send a JSON API ping to the desired url.

{% csrf_token %} {% if form.non_field_errors %}

Non Field Errors:

{{ form.non_field_errors }}

{% endif %} {% for field in form %}
{% if field.errors %}

Field Error: {% for error in field.errors %} {{ error }} {% endfor %}

{% endif %}

{{ field.label }}:

{% if field.help_text %}

{{ field.help_text|safe }}

{% endif %}
{{ field }}
{% endfor %}

Parsed Return-Response

{% if response_error or response_success %}

This is the data that was returned after the previous API send.

{% endif %} {% if response_success %}

Success Sending API Ping

{% for key, value in response_success.items %}

{{ key }}

{{ value }}
{% endfor %} {% endif %} {% if response_error %}

Error Sending API Ping

{% for key, value in response_error.items %}

{{ key }}

{{ value }}
{% endfor %} {% endif %} {% if not response_error and not response_success %}

No return value yet. Submit the API form and the resulting return response will display here.

{% endif %}
{% if sent_data %}

Sent Data

This is what was sent out from this form, on the previous API call.

{% for key, value in sent_data.items %}

{{ key }}

{{ value }}
{% endfor %}
{% endif %}

Example Send Values:

Below are some example form values to get started.

Url:

http://127.0.0.1:8000/test_app/api/parse/

Get Params:

test-param-1=Abc&test-param-2=123

Header Params:

{"Testing": "Test"}

Payload:

{
  "test": true,
  "Aaa": "Bbb",
  "MyNumber": 5
}

Above values will send:

url: http://127.0.0.1:8000/test_app/api/parse/?test-param-1=Abc&test-param-2=123

header: {
  "Accept": "application/json",
  "Testing": "Test"
}

data: {
  "test": true,
  "Aaa": "Bbb",
  "MyNumber": 5
}
{% endblock content %}