| (MFC) Shopware Digest AuthenticationDemonstrates using Digest access authentication for Shopware. For more information, see https://developers.shopware.com/developers-guide/rest-api/#digest-access-authentication 
See Also: Using MFC CString in Chilkat #include <CkHttp.h>
#include <CkStringBuilder.h>
#include <CkJsonObject.h>
void ChilkatSample(void)
    {
    CkString strOut;
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.
    CkHttp http;
    // To use HTTP Digest Authentication, set the login and password, and also indicate that DigestAuth should be used.
    http.put_Login("api_username");
    http.put_Password("api_key");
    http.put_DigestAuth(true);
    CkStringBuilder sbResponseBody;
    bool success = http.QuickGetSb("https://my-shopware-shop.com/api/articles?limit=2",sbResponseBody);
    if (success == false) {
        strOut.append(http.lastErrorText());
        strOut.append("\r\n");
        SetDlgItemText(IDC_EDIT1,strOut.getUnicode());
        return;
    }
    CkJsonObject jResp;
    jResp.LoadSb(sbResponseBody);
    jResp.put_EmitCompact(false);
    strOut.append("Response Body:");
    strOut.append("\r\n");
    strOut.append(jResp.emit());
    strOut.append("\r\n");
    SetDlgItemText(IDC_EDIT1,strOut.getUnicode());
    }
 |