mhakeem
mhakeem

Reputation: 46

cURL XML REST POST in Java Android

How can I convert this statement in cURL curl -i -X POST -H "Content-Type:application/xml" -H "Accept: application/xml" -d "<ticket><summary>This is a Summary</summary><priority>3</priority></ticket>" http://user:[email protected]/spaces/my_space_id/tickets to Java in Android? The most important part is how to invoke the XML in the URL?

Upvotes: 1

Views: 1011

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006674

Use HttpClient, specifically HttpPost for your POST request. The -H switches turn into addHeader() calls. You would probably just use a StringEntity for the XML payload, though I haven't tried a non-urlencoded POST with HttpClient before.

Upvotes: 1

Related Questions