Languages

Menu
Sites
Language
PUT request for Rest API

I've been trying for a few weeks now to make a simple PUT request to a Rest API. I've created an HttpClient helper C++ class to make life easy. However it does not seem as if the data is getting to the server and as a result the server is kicking back a 404 response.

I have a C# background and have prototyped the request I'm trying to make in Powershell where the request works just fine. I just can't seem to get the C++ Curl libraries to do the same.

For better context, this is for my Samsung Gear S3 Classic

I've attached the combined header/implementation files.

Help appreciated!

Thanks,

Brian

Edited by: Brian Mouton on 30 Jan, 2018

Responses

5 Replies
K Johnson

Did try using libcurl? If not, you may check this link.

K Johnson

Sorry it was my mistake, please check this link instead of previous one.

Brian Mouton

The helper class I linked is a wrapper for libcurl.

Brian Mouton

So, I've setup a locally hosted website to direct my requests from my app. The site logs the requests and displays them on a page.

What I've found when comparing my powershell script and my Tizen app is that the request method coming out of the app is "POST" and not "PUT". Something about how I'm marking the request type is wrong.

Brian Mouton

I've fixed my own problem. I was not using strcasecmp properly and it was running lines of code setting the request method in curl to "POST". My helper class works!

By the way. In my original post I've attached my code samples. Are those accessible?

Thanks.