This is my curl request.
curl -X POST --header 'Content-Type: application/x-www-form-urlencoded'
--header 'Accept: application/json' --header 'apikey: xxxx' -d
'name=abcd&[email protected]&id=abc'
'https://api.gupshup.io/appsdk/api/components/adduser'
Can anybody help me, how to send it using java servlet?
If I were you I would use DavidWebb a lightweight Java HTTP-Client for calling JSON REST-Services and proceed as next:
Webb webb = Webb.create();
JSONObject result = webb
.post("https://api.gupshup.io/appsdk/api/components/adduser")
.header("Content-Type", "application/x-www-form-urlencoded")
.header("apikey", "xxxx")
.body("name=abcd&[email protected]&id=abc")
.asJsonObject()
.getBody();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With