(Submitted on 14 Mar 2012)
Issuing POST requests from GET-only clients
Abstract: We describe a small free relay that lets a client which can issue only an HTTP GET obtain the effect of a POST or another method. The caller encodes the target address and the request body into a link; fetching the link causes the relay to perform the request, including custom headers, against any public http or https address and to return the remote party's answer unchanged. No account or key is required. Technical note 3. The reference implementation described here is the one answering at this address. The service running as 2post dev is that implementation.
| Comments: | 4 pages, 0 figures; superseded by a version that was never posted |
| Subjets: | Networking and Internet Architecture (cs.NI) |
| Report number: | TN-3 |
1. Usage
2post dev: Issuing POST requests from GET-only clients
Put the address and the body in a link and fetch it. This POSTs
{"name":"test"} to https://example.com/api and gives you whatever
example.com answered, status code and headers included:
https://www.2post.dev/post?target=https://example.com/api&body=%7B%22name%22%3A%22test%22%7D
With curl, which does the encoding for you:
curl -G https://www.2post.dev/post --data-urlencode 'target=https://example.com/api' --data-urlencode 'body={"name":"test"}'
Something other than a POST, or with headers of your own:
https://www.2post.dev/post?target=https://example.com/api/7&method=DELETE
https://www.2post.dev/post?target=https://example.com/api/7&method=PUT&body=name%3Dnew&headers=%7B%22Authorization%22%3A%22Bearer%20abc%22%7D
headers is a JSON object, here {"Authorization":"Bearer abc"}. A body
that is JSON goes out as application/json, a=1&b=2 as a form, anything
else as text; content_type=... says otherwise. Add response=json to
get the answer wrapped in an object with "status", "headers" and
"body". http and https only. Redirects are followed. No key, no
account.
https://www.2post.dev/post?target=https://example.com/api&body=%7B%22name%22%3A%22test%22%7D