Post and json and RequestHeaders

I want to post the following json code.
After many searches and attempts I have not succeeded.
{“d”: " 393476703888",“f”: “5”,“t”: “1580638982883”,“l”: “”,“s”: {“bluetooth”: {“D0:4F:7E:12:C4:22”: -98,“71:D4:96:19:C9:64”: -96,},“wifi”: {“a4:91:b1:63:40:57”: -92,“12:13:31:f8:d0:5b”: -43,}},“gps”: {“lat”: 43.77231,“lon”: 11.21539,“alt”: 128.63239}}
Can anyone help me?
Thank you
Invia_JSON_01.aia (4.3 KB)

post it from where to where and how ?

Please provide more detailed information about what you are trying to achieve, provide screenshots of your designer/screen and your relevant blocks images.

These bars are part of the bigger app.
Json code is test (and tested)
is sent to the page waiting on the server

The json code is test (and tested).
The bars are part of the more extensive app.
With this App hp tried to separate my problem
The json code is to be sent to the page on the server

Still not really helping…

With this App hp tried to separate my problem ???
sent to the page ???
on the server ???

We only need to see the relevant blocks (where you are trying to send the data)

If you are asking for help, I recommend you to make it as easy for others to be able to help you ...
You probably will get more feedback then...

which means in your case post a screenshot of your relevant blocks...

To download the aia file, upload it to App Inventor, open it, do some bug hunting for you, etc... this takes time, and most people will not do that...
Thank you.

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

PostText Tool Tip

JWEB

You seem to be expecting a file back from control.com (GotFile event), but you never told the Web component to expect one, via the saveResponse flag.

The problem is that this is not a bug, but that I can’t find instructions on how to send a json file with posts.
Do you have a link for this?

I am not asking for help for a bug and error.
What I am asking is to be able to read (or view a threshing file) with instructions for posting a json file.
Do you have a link for this?

I am untrained in agriculture, and have never threshed.

Could you give an example?

Using post, how do you send a file whose content is in json format?

A file or just a json ?

you have a JSON text and not a file, don't you?
if the JSONok.Text property contains the JSON as posted earlier then it should work, but you should use the Web.GotText event to get a result from the server
try it again using the Web.GotText event and let us know if you get a response from the server.

alternatively before posting the JSON, set the property Web.SaveResponse to true, as @ABG already mentioned, a file will then be downloaded from your server and you can use the Web.GotFile event for this

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

no response from the server

well, if you like to use the Web.GotText event, then you have to set SaveResponse to false
see also the documentation Connectivity

SaveResponse
Specifies whether the response should be saved in a file.

Taifun

Tested this on my server with a simple php file which returns the json sent (just for example)

PHP

<?php

$data = file_get_contents('php://input');
echo $data;

?>

(This is the accepted php method to get json data with POST)

BLOCKS

SCREEN (shows output returned from server after pressing the Send button)

I did as recommended, upon sending I received error 908. (see attachment).
What should I do to give write permission?
Or is it a server problem?

If you followed my blocks there should be no need to write to external storage (sdcard). However, if you are still trying to save a file in a compiled app, then you will need to ask for permission to do so.

Add a request permission block to Screen1.Initialise:

android.permission.WRITE_EXTERNAL_STORAGE

Thank you for your answers, I still have problems.
These are the permission bars (are they ok?)
Then, below the server response:
problem binding data
is this a server error?
What kind?

response

My example blocks were for a php server, sending a json text, and receiving a text response back (not a file). You have NOT told us ANYTHING about the server you are trying to use, what it is running and what you are expecting it to do. Without any knowledge of this, it is very difficult to give any advice.