Chilkat Online Tools

unicodeC / Anypoint Platform APIs / Get logs for application deployment

Back to Collection Items

#include <C_CkHttpW.h>
#include <C_CkStringBuilderW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkStringBuilderW sbResponseBody;

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

    http = CkHttpW_Create();

    CkHttpW_SetRequestHeader(http,L"X-ANYPNT-ENV-ID",L"{{environment_id}}");
    // Adds the "Authorization: Bearer {{token}}" header.
    CkHttpW_putAuthToken(http,L"{{token}}");
    CkHttpW_SetRequestHeader(http,L"X-ANYPNT-ORG-ID",L"{{organization_id}}");

    sbResponseBody = CkStringBuilderW_Create();
    success = CkHttpW_QuickGetSb(http,L"https://domain.com/cloudhub/api/v2/applications/{{app_Id}}/deployments/{{deployment_Id}}/logs",sbResponseBody);
    if (success == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkStringBuilderW_Dispose(sbResponseBody);
        return;
    }

    wprintf(L"Response status code = %d\n",CkHttpW_getLastStatus(http));
    wprintf(L"%s\n",CkStringBuilderW_getAsString(sbResponseBody));


    CkHttpW_Dispose(http);
    CkStringBuilderW_Dispose(sbResponseBody);

    }

Curl Command

curl -X GET
	-H "Authorization: Bearer {{token}}"
	-H "X-ANYPNT-ORG-ID: {{organization_id}}"
	-H "X-ANYPNT-ENV-ID: {{environment_id}}"
https://domain.com/cloudhub/api/v2/applications/{{app_Id}}/deployments/{{deployment_Id}}/logs

Postman Collection Item JSON

{
  "name": "Get logs for application deployment",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{token}}",
        "type": "text"
      },
      {
        "key": "X-ANYPNT-ORG-ID",
        "value": "{{organization_id}}",
        "type": "text"
      },
      {
        "key": "X-ANYPNT-ENV-ID",
        "value": "{{environment_id}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{url}}/cloudhub/api/v2/applications/{{app_Id}}/deployments/{{deployment_Id}}/logs",
      "host": [
        "{{url}}"
      ],
      "path": [
        "cloudhub",
        "api",
        "v2",
        "applications",
        "{{app_Id}}",
        "deployments",
        "{{deployment_Id}}",
        "logs"
      ]
    }
  },
  "response": [
  ]
}