How do I send post data from a visualforce page to an external webservice (say foobar.com/someLink) with some data.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Please find the above Class that i used as Utility for POST request.
The String body you will have to construct necessary JSON
The request URL is the URL of the external service
The header Authorization parameter you may set depending on whether external system uses oauth 1.0 or oauth 2.0.
From the visualforce Page you may call this above on the action of button.
Use JSON.serialise to generate JSON data from apex Object .