Casablanca API for POST request to secure host with file upload

Dec 10, 2015 at 9:19 PM
Edited Dec 10, 2015 at 9:37 PM
Hi, I need to do a POST request to a secure host with file upload being a part of it. This is what works fine with the command-line utility curl:
curl -v -s -k -X POST  -H "Content-Type: text/plain" --data-binary <path_to_upload_file> "<upload_filename>&key1=abcde123&key2=<some_key>&format=<some_format>"
Can anyone tell me how do I do it in Casablanca? May be there are some sample code around, I searched, I could not find it. I found some examples about PUT and GET. And how do I configure it to build for 32 bit system?
Dec 10, 2015 at 10:41 PM

Take a look at the sample code I posted here:

You should be able to take the same approach and modify it to match your use case.
Dec 11, 2015 at 5:38 AM
Edited Dec 11, 2015 at 6:37 AM
Thanks. But that is an example of PUT request. :) I did manage to find an example of POST request here: But before that, I need to build it statically for 32 bit system. Can you tell me how do I do that? I made some changes in the cmake text file, like adding option(BUILD_SHARED_LIBS "Build shared Libraries." OFF) to the part under Unix/OS X to build it statically. Doesn't work, getting this error:

  Undefined symbols for architecture i386:

    "_main", referenced from:
       implicit entry/start for main executable

  ld: symbol(s) not found for architecture i386

  clang: error: linker command failed with exit code 1 (use -v to see

  make[1]: *** [cmTryCompileExec4153368370] Error 1

  make: *** [cmTryCompileExec4153368370/fast] Error 2
Dec 11, 2015 at 2:39 PM
You can simply change the method param to make it a post request.
I'm afraid I cant help you with your build issue. I'm on Windows.
Dec 11, 2015 at 4:56 PM
Are you on a 64-bit Linux system? If so, can you build it statically for 64-bit?
~/cpprestsdk/build.relstatic$ cmake -DCMAKE_BUILD_TYPE=Release ../Release -DBUILD_SHARED_LIBS=0
~/cpprestsdk/build.relstatic$ cmake --build . --target cpprest
works for me. If you're trying to build for 32-bit, make sure your host system is 32-bit.