querytopostinteractive / lab
lab
001 colour picker
002 pixel ruler
003 querytopost
004 —
status
003 is online
001, 002 offline
info
no flash needed for this one

querytopost.

a query string goes in, a post comes out

what 01

we needed a banner to report a click to a server that only takes a post, and a banner can only ask for an address. so the address became the request: where it goes and what is in it are written into the link, and this script sends the real thing and hands back the answer. the banner is long gone. the script is still used.

made for a client job in 2002. the client is gone, the script stayed.

how 02

querytopost: a query string goes in, a post comes out

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.querytopost.com/post?url=https://example.com/api&data=%7B%22name%22%3A%22test%22%7D

With curl, which does the encoding for you:

    curl -G https://www.querytopost.com/post --data-urlencode 'url=https://example.com/api' --data-urlencode 'data={"name":"test"}'

Something other than a POST, or with headers of your own:

    https://www.querytopost.com/post?url=https://example.com/api/7&method=DELETE
    https://www.querytopost.com/post?url=https://example.com/api/7&method=PUT&data=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.

try 03




news 04

11.04put, patch and delete. somebody asked.
02.04headers.
09.03moved to the new server. tell us if something broke.
06.02online.
lab 003 / see our work