[IOT-1802] Changing POST to PUT for creating a resource in sample 91/20191/3
authorsaurabh.s9 <saurabh.s9@samsung.com>
Sun, 21 May 2017 09:34:00 +0000 (15:04 +0530)
committerRandeep Singh <randeep.s@samsung.com>
Thu, 15 Jun 2017 08:48:13 +0000 (08:48 +0000)
Change-Id: I8b57b71a2642c0da041034f85c4c66f55e67d782
Signed-off-by: saurabh.s9 <saurabh.s9@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/20191
Tested-by: jenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
Reviewed-by: Randeep Singh <randeep.s@samsung.com>
resource/csdk/stack/samples/linux/SimpleClientServer/occlientbasicops.cpp
resource/csdk/stack/samples/linux/secure/occlientbasicops.cpp

index 9381a81..1e136e2 100755 (executable)
@@ -301,20 +301,20 @@ int InitPostRequest(OCQualityOfService qos)
     query << resource->uri;
     OIC_LOG_V(INFO, TAG,"Executing InitPostRequest, Query: %s", query.str().c_str());
 
-    // First POST operation (to create an LED instance)
-    result = InvokeOCDoResource(query, OC_REST_POST, &resource->endpoint,
+    // First PUT operation (to create an LED instance)
+    result = InvokeOCDoResource(query, OC_REST_PUT, &resource->endpoint,
             ((qos == OC_HIGH_QOS) ? OC_HIGH_QOS: OC_LOW_QOS),
-            postReqCB, NULL, 0);
+            putReqCB, NULL, 0);
     if (OC_STACK_OK != result)
     {
         // Error can happen if for example, network connectivity is down
         OIC_LOG(ERROR, TAG, "First POST call did not succeed");
     }
 
-    // Second POST operation (to create an LED instance)
-    result = InvokeOCDoResource(query, OC_REST_POST, &resource->endpoint,
+    // Second PUT operation (to create an LED instance)
+    result = InvokeOCDoResource(query, OC_REST_PUT, &resource->endpoint,
             ((qos == OC_HIGH_QOS) ? OC_HIGH_QOS: OC_LOW_QOS),
-            postReqCB, NULL, 0);
+            putReqCB, NULL, 0);
     if (OC_STACK_OK != result)
     {
         OIC_LOG(ERROR, TAG, "Second POST call did not succeed");
index 2257228..18f154b 100644 (file)
@@ -244,20 +244,20 @@ int InitPostRequest(OCDevAddr *endpoint, OCQualityOfService qos)
     std::ostringstream query;
     query << coapServerResource;
 
-    // First POST operation (to create an LED instance)
-    result = InvokeOCDoResource(query, OC_REST_POST, endpoint,
+    // First PUT operation (to create an LED instance)
+    result = InvokeOCDoResource(query, OC_REST_PUT, endpoint,
                                 ((qos == OC_HIGH_QOS) ? OC_HIGH_QOS : OC_LOW_QOS),
-                                postReqCB, NULL, 0);
+                                putReqCB, NULL, 0);
     if (OC_STACK_OK != result)
     {
         // Error can happen if for example, network connectivity is down
         OIC_LOG(INFO, TAG, "First POST call did not succeed");
     }
 
-    // Second POST operation (to create an LED instance)
-    result = InvokeOCDoResource(query, OC_REST_POST, endpoint,
+    // Second PUT operation (to create an LED instance)
+    result = InvokeOCDoResource(query, OC_REST_PUT, endpoint,
                                 ((qos == OC_HIGH_QOS) ? OC_HIGH_QOS : OC_LOW_QOS),
-                                postReqCB, NULL, 0);
+                                putReqCB, NULL, 0);
     if (OC_STACK_OK != result)
     {
         OIC_LOG(INFO, TAG, "Second POST call did not succeed");