Sample code for 30+ languages & platforms
Unicode C++

Send a REST Request with No Body

See more REST Examples

Demonstrates Rest.FullRequestNoBody, which sends a complete request with no request body (such as a GET or DELETE) and returns the response body as text.

Background. This is the simplest full-request convenience method, ideal for retrieval and deletion calls that carry no request payload.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkRestW.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkRestW rest;
    bool bTls = true;
    bool bAutoReconnect = true;
    success = rest.Connect(L"example.com",443,bTls,bAutoReconnect);
    if (success == false) {
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    //  Send a complete request with no request body, such as a GET or DELETE.  The response body is read
    //  as text and returned.
    const wchar_t *responseText = rest.fullRequestNoBody(L"GET",L"/api/items/123");
    if (rest.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",rest.lastErrorText());
        return;
    }

    wprintf(L"%s\n",responseText);
    }