REST client in C++
Asked Answered
I

4

10

Has anybody successfully tried any C++ REST library (client) in their enterprise product? It can be collection of software stack, but it should have the capability to run on all platforms, i.e.: Windows, Linux, Solaris, AIX, HP-UX.

Insensible answered 12/11, 2012 at 8:39 Comment(2)
I've had plenty of success using libcurl against REST servers. Perhaps you could be more specific in your needs (support for default actions? support for different http keywords ? Supports deserialization of xml/json ?)Bullivant
after looking into java REST client implementation here are few key support that are required. HttpClient like support (like @Michael-O mentioned transport layer). 2. serialization support for XML (here i will prefer something which is having a good binding with schema - even though looks anti-REST) so that developers don't have to write xml parsers everywhere. 3. Not evaluated JSON support yet.Insensible
F
2

C++ REST SDK is an actively developed C++ REST client that is currently supported in Windows, Mac OS X, iOS and Android. It is also licensed under Apache License 2.0 which opens up a range of customizations on the library to suit your needs.

Fontenot answered 21/7, 2015 at 12:31 Comment(2)
In 2021 cpprestsdk is in maintenance mode and we do not recommend its use in new projects. We will continue to fix critical bugs and address security issues.Lauer
How about Ubuntu?Overt
J
2

You may want to check thin REST client for C++ at https://github.com/mrtazz/restclient-cpp.

It is a C++ wrapper around good and stable multiprotocol, multiplatform libcurl library.

Jaundiced answered 10/6, 2016 at 18:10 Comment(0)
A
2

Here is the list for most useful C++ libraries include network library: https://en.cppreference.com/w/cpp/links/libs

you can see listed can be used as REST client library:

  1. Boost.Beast
  2. C++ REST SDK
  3. curlpp
Auspicious answered 5/5, 2022 at 8:55 Comment(1)
For light weight usage, I am using libcpr/cpr in laoshanxi/app-mesh replaced cpprestsdk.Auspicious
G
1

I cannot recommend any integrated solution but what you can do is use:

  1. Transport: neon, serf or libcurl (all of them have advs and disadvs)
  2. XML parsing: libexpat or libxml2
  3. JSON parsing: Jansson or JSON Spirit
Grandmotherly answered 12/11, 2012 at 8:50 Comment(3)
Thanks @Grandmotherly but this is very crude stack to begin with (ie: it does all the job requred but still will need lot of boilerplate code to be implemented by the developer). What i am looking at something more in terms with java implementation of REST HttpClient (more like cassandra) but not tied to single platform.Insensible
I doubt that you will find something functionally similar to any Java-based client in C++. The second problem is that you want it portable the above libraries do other client maybe not or they depent ono the above.Grandmotherly
agreed. looks like c++ is not having much mature lib to handle REST. I was curious on that in case some implementaion like gSOAP has been done. hope this thread will get better answers later.Insensible

© 2022 - 2024 — McMap. All rights reserved.