Hi,
is the maximum length of the payload 4950?
I can send a string up to this length using a note.template.
But if I set a higher value for the payload’s length and add a note using a payload of the respective length I get the following error (when I try to hub.sync)
{
“err”: “cannot interpret JSON: unrecognized base64 at offset 4950 {io}”
}
Best regards,
Theo
Hi @theogrm and welcome to the Blues community!
We generally recommend the maximum length of a payload to be 8KB (but that has more to do with your cellular connectivity, there is plenty of free storage available in flash). I wonder if you somehow have an invalid base64 character in your payload? Have you tried decoding it with another tool?
Rob
Hi Rob,
still the same problem, with the base64 strings longer than 4950 characters. The attached python code is the one I’m using to generate and test the size of the payload. It also decodes it and compare to the original data. As an example, with an array of integers of size 1200 (2.8kb - 2828 characters) it is possible to send the payload.json. However, if the size of the array increases to 2600 (6 kb - 6028 characters) I get the following error: {
“err”: “cannot interpret JSON: unrecognized base64 at offset 4950 {io}”
}
Python attached.
Thanks for the help.
Theo
PayloadPython.txt (1.6 KB)
Hi @theogrm,
Which version of the Notecard firmware are you on? And can you send me the note.template
request you used to create the template?
I’d also be curious to see what would happen if you switched to a web.post
call instead of using note.add
. See our doc on Web Transactions and the Web Request APIs.
Rob
Hi Rob,
the notecard is the NOTE-WBEX-500 running firmware 5.1.1.16026
Tested with other notecard with firmware 4.2.1.4015688 (same error)
{
“req”: “note.template”,
“file”: “readings.qo”,
“length”: 9500
}
I just tested the web.post (first time now). I was able to send, but only the smaller one. When sending more characters I get the following error.
{
“err”: “cannot interpret JSON: unrecognized base64 at offset 4927 {io}”
}
Theo
Hi Rob,
Fund what I was doing wrong.
I was trying to send via browser connection, just pasting the json there.
It works just fine when sending via serial.Serial using python.
Again, thanks for the help.
Theo
Ah good to hear! My next suggestion was going to be to try removing the length
parameter from the note.template
request (that is no longer required in recent versions of the Notecard firmware when using payload
).