02-11-2013 09:46 AM
Good morning all,
I am trying to use a REST API but I don't really know what to import in order that I can input the url. Any help is greatly appreciated.
Thanks in advance!
Peter
02-11-2013 09:57 AM
02-11-2013 10:09 AM
Are you delaing with HTTP GET or POST???
02-11-2013 10:13 AM
02-11-2013 10:35 AM
I need to make both from what I understand
02-11-2013 10:39 AM
Hello mayureshq,
Thank you for your reply. From what I understand I am supposed to make both the GET and POST. Also I am trying to make this for BB versions 7.0 and above. Does this change anything?
02-11-2013 11:13 AM
02-11-2013 11:53 AM
02-12-2013 12:44 AM
Hi pxlam15
Below is the code to send your Json object to server.
finalObject is a Json object.
hc = (HttpConnection) Connector
.open(URL);
hc.setRequestMethod(HttpConnection.POST);
hc.setRequestProperty("Content-Type", "application/json");
os = hc.openOutputStream();
String data = "placeOrder=" + finalobject.toString();
os.write(data.getBytes());
os.flush();
os.close();