If you create a M2MResource of type String and connect it to Pelion, it works fine with short strings (under perhaps 200 characters).
If you try to edit a string in the web interface that’s longer than 200 or so characters the web interface will truncate your PUT to the first 200 or so characters.
I wanted to upload a large TLS certificate for various reasons, which obviously will not fit in 200 chars LOL, and I thought Pelion would be a convenient way to manage those certs on multiple devices (as opposed to compiling in a new C++ file for each device, LOL)
Anyway the solution I found was the API does NOT truncate strings. So I wrote a simple BASH shell script on FreeBSD to upload my large TLS certs and it worked.
The script works something like this, in concept.
Need a safe space to store your personal API key, like a file named apikey.txt
export APIKEY = cat apikey.txt (wrapped in backticks that this web forum software does not like)
curl was unhappy with multi-line payloads, so after converting the cert to base64 I simply remove the newlines and CR and have one monsterously long string (as opposed to typical base64 which has like 60 chars per line)
export ROOTCA = cat rootCA.pem | base64 | tr -d ‘\n’ | tr -d ‘\r’ (wrapped in backticks that this web forum software does not like)
My curl line looks like any other example of using the API, except I have my Authorization line and my json payload line in double quotes to permit bash shell variable substitution, which means in the json I have to backslash prefix my double quotes, which is moderately annoying but it works fine.
There are many other ways to use the API, of course.
Interestingly the web client can display long strings once you upload them using the API, the web client just can’t edit and upload a new long string.
The whole point of this post is to document the work around for the web client not supporting PUT long strings, is simply to upload long strings by writing a program to use the API.
This works great and is fast and reliable. Thanks and Good Luck!