Chilkat Online Tools

ERROR!

------------------- GenerateCode ----------------------
---- begin chilkat script ----
// This example assumes the Chilkat API to have been previously unlocked.
// See {{-global_unlock:::Global Unlock Sample-}} for sample code.

new Http http;
ckbool success;

call http.SetRequestHeader("Authorization","{{WACApiKey}}");

new StringBuilder sbResponseBody;
success = http.QuickGetSb("https://domain.com/v1/accounts/:AcctNum/invoices",sbResponseBody);
if (success == ckfalse) {
    println http.LastErrorText;
    return;
}

println "Response status code = ",http.LastStatus;
println sbResponseBody.GetAsString();

---- end chilkat script ----

C / WAC API / Get All Sub-Invoices for Sub-Account

Back to Collection Items

#include <C_CkHttp.h>
#include <C_CkStringBuilder.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkStringBuilder sbResponseBody;

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    http = CkHttp_Create();

ERROR: Non-existent Chilkat method:  Http.SetRequestHeader
ERROR: Non-existent Chilkat method:  Http.SetRequestHeader

    sbResponseBody = CkStringBuilder_Create();
ERROR: Entry not found: Http.QuickGetSb
ERROR: CodeGen:
  emitNewObject:
    atgType: Http
    varName: http
  --emitNewObject
  emitNewObject:
    atgType: StringBuilder
    varName: sbResponseBody
  --emitNewObject
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
--CodeGen

ERROR: Non-existent Chilkat method:  Http.QuickGetSb
Assignment type mismatch.  ExpressionType=ERROR:, atgType=ckbool

    if (success == FALSE) {
ERROR: Entry not found: Http.LastErrorText
ERROR: CodeGen:
  emitNewObject:
    atgType: Http
    varName: http
  --emitNewObject
  emitNewObject:
    atgType: StringBuilder
    varName: sbResponseBody
  --emitNewObject
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
--CodeGen

        printf("%d\n",CkHttp_getLastErrorText(http));
        CkHttp_Dispose(http);
        CkStringBuilder_Dispose(sbResponseBody);
        return;
    }

ERROR: Entry not found: Http.LastStatus
ERROR: CodeGen:
  emitNewObject:
    atgType: Http
    varName: http
  --emitNewObject
  emitNewObject:
    atgType: StringBuilder
    varName: sbResponseBody
  --emitNewObject
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
  failedToLoadClass: Http
  failedToLoadClass: Http
  getApiProperty:
    Class not found
    className: Http
  --getApiProperty
--CodeGen

    printf("Response status code = %d\n",CkHttp_getLastStatus(http));
    printf("%s\n",CkStringBuilder_getAsString(sbResponseBody));


    CkHttp_Dispose(http);
    CkStringBuilder_Dispose(sbResponseBody);

    }

Curl Command

curl -X GET
	-H "Authorization: {{WACApiKey}}"
https://domain.com/v1/accounts/:AcctNum/invoices

Postman Collection Item JSON

{
  "name": "Get All Sub-Invoices for Sub-Account",
  "request": {
    "auth": {
      "type": "noauth"
    },
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "{{WACApiKey}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{baseURL}}/v1/accounts/:AcctNum/invoices",
      "host": [
        "{{baseURL}}"
      ],
      "path": [
        "v1",
        "accounts",
        ":AcctNum",
        "invoices"
      ],
      "variable": [
        {
          "key": "AcctNum",
          "value": ""
        }
      ]
    }
  },
  "response": [
  ]
}