JSON POST from a Kinetis Micro

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

JSON POST from a Kinetis Micro

1,013 Views
tharonhall
Contributor IV

I realize that getting the TCP connection up to make this happen may be the largest part of the battle, but is there an easy way to do the equivalent to the following on a Kinetis micro:

curl --include \
   --request POST \
   --header "Content-Type: application/json" \
   --header "X-IS-AccessKey: YOUR_KEY" \
   --header "X-IS-BucketKey: curl_example_bucket" \
   --header "Accept-Version: 0.0.1" \
   --data-binary "[
  {
  \"key\": \"tempurature\",
  \"value\": \"22.2\",
  \"epoch\": 1419876021.778477
  },
  {
  \"key\": \"temperature\",
  \"value\": \"23.2\",
  \"epoch\": 1419876031.778477
  },
  {
  \"key\": \"temperature\",
  \"value\": \"22.1\",
  \"epoch\": 1419876061.778477
  }
]"
\
'https://groker.initialstate.com/api/events'


Could a Serial Port Protocol Bluetooth connection to a TCP/IP connected host be a solution? I am looking for a quick and dirty way to do IoT type functionality using a FRDM board and the stuff at InitialState looks appealing if I can get the support going on my end.


Thanks!


Tharon Hall


0 Kudos
3 Replies

530 Views
Luis_Garabo
NXP TechSupport
NXP TechSupport

Hi Tharon,

What you are requesting requires not only the TCPIP stack but a SSL for the connection with the HTTPS server. You have two options. For the FRDM-K64F we have SSL stack in MQX. This may require a little bit more of efforts compared with the second option; mbed. Since you want a quick solution then I suggest trying with mbed. Try to import this example in your mbed on-line compiler: CyaSSL-Twitter-OAuth4Tw - a mercurial repository | mbed

For MQX, take a look to this post: CyaSSL embedded SSL now available for MQX!

I hope this helps you.

Regards,

Garabo

530 Views
tharonhall
Contributor IV

I am a bit leery about attempting to use mbed as I did my current project on mbed but their RTOS failed when I exported it over KDS. I lost confidence that the process is "ready for prime time". I agree that mbed has tremendous potential and hope they can get the bugs worked out.

Having said that, I believe it would lead us to an MQX solution. As MQX options come up frequently in responses to my questions, I may want to seriously consider switching my OSA flavor from FreeRTOS to MQX.

Regards,

Tharon

0 Kudos

530 Views
mjbcswitzerland
Specialist V

Hi Garabo

I think that the server also accepts HTTP connections as well as HTTPS but of course if it has to be secure it is a much greater effort, especially for people without SSL experience. At least the client is the easier side - as long as the server doesn't demand authentication!

Regards

Mark

Kinetis: µTasker Kinetis support

For the complete "out-of-the-box" Kinetis experience and faster time to market

0 Kudos