Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

Posts: 80
Registered: ‎05-22-2011
My Device: Blackberry Torch
My Carrier: Airtel

Sending data over HTTP post in Cascades

Hi Everyone,


I am new to Cascades development. I am now learning how to code in Cascades for my next project. 

Can someone help me on how to send data (in bytes) over Http post in Cascades?


The requirement is like, I need to send data which is in JSON format to a web service. I saw few samples for accessing web content via GET method but I did not see a good example for POST method. 


Any help will be much appreciated. 


Thank you in advance. 

Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: Sending data over HTTP post in Cascades



 Please check below thread 






feel free to press the like button on the right side to thank the user that helped you.

Posts: 38
Registered: ‎09-27-2012
My Device: 9930
My Carrier: airtel

Re: Sending data over HTTP post in Cascades

Hi all.,


I have this same doubt..,please help me..,the link provided here is useful but it does not fill my need. I need to send a json request like this with http post.

   "username" : "my_username",
   "password" : "my_password",
   "validation-factors" : {
      "validationFactors" : [
            "name" : "remote_address",
            "value" : ""

 Please help me..,I couldn't find a useful tutorial in this...


Thanks in advance.

New Developer
Posts: 27
Registered: ‎09-18-2013
My Device: Z10
My Carrier: +

Re: Sending data over HTTP post in Cascades

Did you find the solution?

Posts: 543
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....
My Carrier: Telekom Slovakia

Re: Sending data over HTTP post in Cascades

[ Edited ]

Here is GET/POST example also



@varghesekiran @ZuzooVn

I know of two options for creating JSON



Use QVariant/QVariantMap/QVariantList

QVariantMap map; // username nad password
map.insert("username", "my_username");
map.insert("password", "my_password");

QVariantMap map2; // name and value
map2.insert("name", "remote_address");
map2.insert("value", "");

QVariantList list; // [name and value]
list << map2; // append name and value

QVariantMap map3; // validationFactors
map3.insert("validationFactors", list);

map.insert("validation-factors", map3);

And now you need to serialize result (map) You can use external JSON library like a QtJson http://qjson.sourceforge.net or build in like JsonDataAccess

JsonDataAccess json;
QByteArray array;
json.saveToBuffer(map, &array); /* AND THE RESULT IS { "password" : "my_password", "username" : "my_username", "validation-factors" : { "validationFactors" : [ { "name" : "remote_address", "value" : "" } ] } } */


Or you can build it directly with QByteArray

QByteArray json;

json += "{"; // start brace
json += "\"username\": \"my_username\","; // username
json += "\"password\": \"my_password\","; // password
json += "\"validation-factors\": {";
json += "\"validationFactors\": [";
json += "{ \"name\": \"remote_address\",";
json += "\"value\": \"\" } ] }";
json += "}"; // end brace

   "password" : "my_password",
   "username" : "my_username",
   "validation-factors" : {
      "validationFactors" : [
            "name" : "remote_address",
            "value" : ""

Hope it helps 

If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog