static exportrelay_test.ipynb

get2post/dev

POST requests for tools that only fetch

Exported from the notebook I used to test it. The cells are static; the endpoint is live.

In [1]:
curl -G https://www.get2post.dev/relay --data-urlencode 'url=https://example.com/api' --data-urlencode 'data={"name":"test"}'
In [2]:
usage()
Out[2]:
get2post/dev: POST requests for tools that only fetch

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

The same thing under names that are easier to remember:

    https://www.get2post.dev/relay?url=...&data=...
    https://www.get2post.dev/post?url=...&data=...
    https://www.get2post.dev/send?url=...&data=...

With curl, which does the encoding for you:

    curl -G https://www.get2post.dev/relay --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.get2post.dev/relay?url=https://example.com/api/7&method=DELETE
    https://www.get2post.dev/relay?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.
In [5]:
call 'https://www.get2post.dev/?url=https://example.com/api&data=%7B%22name%22%3A%22test%22%7D'
Traceback (most recent call last): File "<cell>", line 1, in <module> TimeoutError: no answer from the other side within 30 s

TODO

In [9]:
widget()