{% extends "master.html" %} {% block title %}API{% endblock %} {% block main %}
Using the API for this application is pretty simple. Just send a request to
http://sqlformat.appspot.com/format/
The server accepts various options to control formatting. Only
the data option is required. All others are optional.
Either use GET
and pack the options in the query string
or POST
and submit your parameters as form data.
When using POST
make sure your request includes a
Content-Type: application/x-www-form-urlencoded header.
Here's a example in Python:
{% include "python-client-example.html" %}Download sqlformat_example_client.py
And another example using curl and a GET
request:
$ curl "http://sqlformat.appspot.com/format?keyword_case=upper&reindent=true&data=select%20*%20from%20foo;"
SELECT *
FROM foo;
$