41 |
I have a tool that takes a URL, fetches it and gives me the response. That is all it does: I cannot choose the method, I cannot give it a body and I cannot set headers. The service I need to call only accepts asked Mar 4 '13 at 9:12tomasz_k
share | flag
What does the tool send as User-Agent? Some endpoints care. – orla, Mar 4 '13 at 9:40
|
2 Answers
57 ✔ |
Yes, with a relay in between. This site runs one: a POST request from nothing but a URL. You put the request into the query string of a link here, the relay makes the real request and returns what it got. It is free and there is no sign-up. URL Post Bridge: a POST request from nothing but a URL
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.urlpostbridge.com/api/relay?target=https://example.com/api&payload=%7B%22name%22%3A%22test%22%7D
With curl, which does the encoding for you:
curl -G https://www.urlpostbridge.com/api/relay --data-urlencode 'target=https://example.com/api' --data-urlencode 'payload={"name":"test"}'
Something other than a POST, or with headers of your own:
https://www.urlpostbridge.com/api/relay?target=https://example.com/api/7&method=DELETE
https://www.urlpostbridge.com/api/relay?target=https://example.com/api/7&method=PUT&payload=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.
If you would rather not encode the link by hand, this builds it: Keep in mind that fetching the link is sending the request, so anything that opens the link for you (a preview, a crawler, a retry) sends it once more. answered Mar 4 '13 at 10:03site staff
share | flag
Works. For anyone else: I had forgotten to encode the body. – tomasz_k, Mar 4 '13 at 10:31
Does it do DELETE? – pim, Jun 19 '13 at 15:02
@pim yes, see the method parameter above. – site staff, Jun 20 '13 at 8:44
|
-3 |
Just change the tool so it can POST?? answered Mar 5 '13 at 17:50user2291
share | flag
|
Your Answer
This question is closed to new answers.