| Author | Message |
|---|---|
| admin Site Admin Joined: 14 Mar 2004 Posts: 212 |
Posted: Sat Feb 12, 2005 4:41 pm Post subject: HOW TO: get a POST out of a tool that only does GET[quote]
Pinned because it gets asked every other week. If your script, feed reader, spreadsheet or whatever can only open a web address and cannot send a POST, you can still send one. You open an address on this site that says where the request should go and what should be in it. The site sends it and shows you what came back. That is the entire trick. Code:
Get Into Post: get a POST out of a tool that only does GET
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.getintopost.com/api/send?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.getintopost.com/api/send --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.getintopost.com/api/send?target=https://example.com/api/7&method=DELETE
https://www.getintopost.com/api/send?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.
Or fill this in and press the button, it makes the same address for you: Opening the address is sending the request. If you post one of these in a thread, everybody who clicks it sends it again. You have been warned :) Free for as long as nobody abuses it. _________________ Read the sticky before you post. Then read it again. |
| Back to top | profile pm |
| dkl_77 Newbie Joined: 02 Feb 2005 Posts: 3 |
Posted: Sat Feb 12, 2005 9:03 pm Post subject: Re: HOW TO[quote]
works great from my rss thing, thx!! |
| Back to top | profile pm |
| marrow Regular Joined: 30 Aug 2004 Posts: 58 |
Posted: Mon Feb 14, 2005 11:17 am Post subject: Re: HOW TO[quote]
Can it do PUT? The thing I talk to wants PUT for updates. _________________ |
| Back to top | profile pm |
| admin Site Admin Joined: 14 Mar 2004 Posts: 213 |
Posted: Mon Feb 14, 2005 6:52 pm Post subject: Re: HOW TO[quote]
Yes. Add method=PUT. I put it in the first post. _________________ Read the sticky before you post. Then read it again. |
| Back to top | profile pm |