How do I do a HTTP POST in App Inventor?

19 views
Skip to first unread message

dpgui...@gmail.com

unread,
Apr 29, 2016, 7:46:29 PM4/29/16
to MIT APP INVENTOR 2
Brand new to this and spent a good deal of time searching for this information. Got it working in Kinetise but those chaps want $100 month. Not!

I am using Bluemix with a cloudant nosql database.

The API URL is,
https://6bf8b7fb-a253-4433-a8e3-20da37e95dee-bluemix.cloudant.com/dpjg-sensorlog3/_find

The code from Postman which works perfectly!!!

POST /dpjg-sensorlog3/_find HTTP/1.1
Host: 6bf8b7fb-a253-4433-a8e3-20da37e95dee-bluemix.cloudant.com
Authorization: Basic dHRlcnNlZW5ncnRpbmV2ZW5zd2Vyc3R1OmJmNGMzZmRkOTFjMzVjNDYyN2JmNDBiN2ViYTFkNjBhMzkyMjhhZDc=
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 666e0601-41de-de9a-e8e4-346cc353eb71

{
"selector": {
"tme": {
"$gt": 0
}
},
"fields": [
"tme",
"oat",
"sot",
"oah",
"rnt",
"lux",
"bxt",
"spv",
"btv",
"hea"
],
"sort": [
{
"tme": "desc"
}],
"limit":1
}

The sample response is,
{"docs":[
{"tme":"2016-04-29T19:36:18-04:00","oat":"77.2","sot":"78.0","oah":66.1,"rnt":0,"lux":73,"bxt":0,"spv":"4.3","btv":"3.6","hea":33024}
]}

I cannot figure out how to set this up in a block.

nicoma...@googlemail.com

unread,
Apr 29, 2017, 4:58:56 AM4/29/17
to MIT APP INVENTOR 2
Use the "post" block of the "Web" component.
Reply all
Reply to author
Forward
0 new messages