BradlyMan BradlyMan - 11 months ago 123
HTTP Question

How to sendi HTTP request and parse JSON response in TIZEN watch using Native?

Hi I'am new to Tizen Development and would like to explore functions/features like what I used in android development. So I want to learn how to post/get HTTP and parse the json response from the URL using Native Tizen watch. Can anyone help me or point me to some tutorials?

Answer Source

You can do this using curl . Here is an example using:

Add these headers

#include <curl/curl.h>
#include <net_connection.h>

And implement like this

    /* Initialize CURL */ 
    CURL *curlHandler = curl_easy_init();

    connection_h connection;

    int conn_err;
    conn_err = connection_create(&connection);
    if (conn_err != CONNECTION_ERROR_NONE) {
        /* Error handling */
        return false;

    if(curlHandler) {
      /* Set CURL parameters */
      curl_easy_setopt(curlHandler, CURLOPT_URL, "");
      curl_easy_setopt(curlHandler, CURLOPT_CUSTOMREQUEST, "POST");
      curl_easy_setopt(curlHandler, CURLOPT_POSTFIELDS,  jObj);

      /* Perform the request */ 
      CURLcode res = curl_easy_perform(curlHandler);

      /* Check for errors */ 
      if(res != CURLE_OK)
        fprintf(stderr, "CURL failed: %s\n",

      /* Clean up */ 
      json_object_object_del(jObj, "name");

You can also check this link and this link.

Tutorial: This