Use C++ Client API
The generated c++ api dir structure is
UserItem.h UserItemAPI.h UserItemAPI.cpp Makefile
How to use it:
- First use the makefile to generate a client api lib file
- Create REST Client intance
- Create named request instance
- Set request param values
- Use RestClient call request
- Use the return values
Here is a code snippet:
#include <UserItem.h> #include <UserItemAPI.h> #include <CSHttpAPIBase.h> CSHttpAPIClientInfo client; client.sServerURI = "http://127.0.0.1:8001/api"; UserGetAction req(client); req.setUserName("test"); if (req.execute()) { printf("user email: %s\n", req.result->email.c_str()); } else { printf("Get User Error:%s\n", req.getErrorMessage().c_str()); }