sudo make install
make
./bin/bin
//#include "http/veridic"
Veridic Url("https://URL");
string data = Url.get();
cout << data;
make http requests easily in c++ using libcurl, contains two modules, raw http and Veridic that wraps the raw giving it even more functions, I recommend using Veridic but if you want you can use raw http but it has certain limitations, such as only making one request per instance which does not happen in Veridic
- HTTP RAW (wrap curl)
- VERIDIC (wrap HTTP RAW)
in main or function etc
Veridic tasty("https://API_name");
POST fields = {
"name: jhon",
"lastname: doe"
}
Headers headers = {
"data: test",
"example: true"
};
tasty.post(fields, headers, "/user");
tasty.post(fields, "/users");
tasy.post(fields);
- POST
- GET
- PUT
- DELETE
- CUSTM
the structure is very flexible in case you want to use directly the one I put, as long as you add the .cpp code inside the src/sources folder and add it in the makefile like this
$(DIR_OBJ)/myFile.o
the fields are a structure in charge of controlling and preparing the necessary parameters for the requests, they have no limit
Examples
in headers fields, DATA: VALUE
Headers = {
"data: 1",
"data: 2",
"data: N",
"N: N",
};
same that post >>>
in POST fields, DATa=value
POST fields = {
"uno=1",
"dos=2",
"tres=3",
"N=N"
};
GET fields = {
"uno=1",
"dos=2",
"tres=3",
"N=N"
};
PUT fields = {
"uno=1",
"dos=2",
"tres=3",
"N=N"
};
DELETE fields = {
"uno=1",
"dos=2",
"tres=3",
"N=N"
};
the fields are the same structure but with a typedef to make the code easier to read, the only difference is the field Headers, which has another structure