Raj2022
November 14, 2022, 1:41am
1
I made a few apps using MIT AI. Thanks to the team.
I want to create a new channel in my Thingspeak account.
They recommend the below explained in (Create new channel with HTTP POST - MATLAB - MathWorks India )
POST https://api.thingspeak.com/channels.json
api_key=XXXXXXXXXXXXXXXX
name=My New Channel
expected response is as below with a new channel created on thingspeaks.
{
"id": 4,
"name": "My New Channel",
"description": null,
"metadata": null,
"latitude": null,
"longitude": null,
"created_at": "2014-03-25T13:12:50-04:00",
"elevation": null,
"last_entry_id": null,
"ranking": 15,
"username": "iothans",
"tags": [],
"api_keys":
[
{
"api_key": "XXXXXXXXXXXXXXXX",
"write_flag": true
}
]
}
after launching the app channel is not created and the responses on the app is
you can not post a list, but try to post a string like aa=bb&cc=dd, or use a buildRequestData block
Taifun
November 14, 2022, 12:33pm
3
Also you forgot to set the request header
Content-Type
application/x-www-form-urlencoded
Taifun
1 Like
Raj2022
November 15, 2022, 12:50pm
4
Kevinkun:
buildRequestData
But buildRequestData is a call so do I post the URL first?
Taifun
November 15, 2022, 12:55pm
5
Here is an example App Inventor Tutorials and Examples: MySQL | Pura Vida Apps
Remove the Get method
EDIT: Add the Request header block
Use the Post method together with the BuildRequestData method as shown in the example
Taifun
Raj2022
November 16, 2022, 2:22am
8
Thank you Taifun and Kevinkun, I could create the channel successfully.
the blocks are as seen below. I still need your help in passing three more parameters.
name=My Channel (this is done with your help)
public_flag=true
field1=Stuff
field2=Things
field3=Data
These are working blocks for channel creation.
I tried this
and this but no success. (
creates a channel with the name " MyChannel1\nfield1=Stuff\nfield2=Things\nfield3=Data")
Please guide
Taifun
November 16, 2022, 12:14pm
10
The request header block needs a list of sublist, each of the sublists is a tag/value pair.. as it is working without being correct, you can omit that block
Also the BuildRequestData method needs a list of sublists, i.e.withoug the =
name
MyChannel1
field1
Stuff
field2
Things
field3
data
Taifun
Raj2022
November 23, 2022, 4:01am
11
Thank you Taifun and Kevinkun, I think my issues are addressed.
Below is the block I used for testing and it worked
but your block is not correct for the RequestHeaders, it should be a list of list, as @Taifun mentioned in last post.
Did you got any error message?
system
Closed
November 30, 2022, 5:17am
13
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
Raj2022
December 11, 2022, 9:30am
14
This is in continuation of the below post
The result of above was & it is working
But I tried to modify the data as below
The system works but I get a message as
Please help to find the error.
A few days ago we found an error in the SpreadSheet component with the join block. I don't know if the join with Web has the same error.
https://community.appinventor.mit.edu/t/testers-wanted-google-sheets-component/49195/58
Check to put the data in an Intermediate Label.
header should be a list of list.
You need to add a 'make a list' block.
Raj2022
December 11, 2022, 2:11pm
18
Tried the below blocks, same response with no success also the channel is not created.
Taifun
December 11, 2022, 3:01pm
19
You misunderstood..
The request header must be a list of lists, I.e. 2 make a list blocks....
See again
The request header block needs a list of sublist, each of the sublists is a tag/value pair.. as it is working without being correct, you can omit that block
Also the BuildRequestData method needs a list of sublists, i.e.withoug the =
name
MyChannel1
field1
Stuff
field2
Things
field3
data
Taifun
Taifun
Raj2022
December 12, 2022, 1:31pm
20
Thanks Juan,
I tried as suggested by you.
But no change.
Raj2022
December 12, 2022, 1:34pm
21
Dear Taifun,
if I change anything in request header the channel creation is not happing as per requirements.
We can only work with the PostText .
do you know the meaning of 'list of list'?
or set the header as a Dictionary.