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","{{apiKey}}");
call http.SetRequestHeader("Accept","application/pdf");

new StringBuilder sbResponseBody;
success = http.QuickGetSb("https://api.easybill.de/rest/v1/documents/:id/pdf",sbResponseBody);
if (success == ckfalse) {
    println http.LastErrorText;
    return;
}

ERROR: ExpectedResponseType not yet supported...
ExpectedResponseType: [application/pdf]
m_reqType = 8
ERROR: Something in the response processing not yet supported...

---- end chilkat script ----

Java / easybill REST API / Fetch pdf document

Back to Collection Items

import com.chilkatsoft.*;

public class ChilkatExample {

  static {
    try {
        System.loadLibrary("chilkat");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed to load.\n" + e);
      System.exit(1);
    }
  }

  public static void main(String argv[])
  {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkHttp http = new CkHttp();
    boolean success;

    http.SetRequestHeader("Authorization","{{apiKey}}");
    http.SetRequestHeader("Accept","application/pdf");

    CkStringBuilder sbResponseBody = new CkStringBuilder();
    success = http.QuickGetSb("https://api.easybill.de/rest/v1/documents/:id/pdf",sbResponseBody);
    if (success == false) {
        System.out.println(http.lastErrorText());
        return;
        }

ERROR: "=" expected
ERROR: Undefined variable(ERROR)
  }
}

Curl Command

curl -X GET
	-H "Authorization: {{apiKey}}"
	-H "Accept: application/pdf"
https://api.easybill.de/rest/v1/documents/:id/pdf

Postman Collection Item JSON

{
  "name": "Fetch pdf document",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/pdf"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/documents/:id/pdf",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "documents",
        ":id",
        "pdf"
      ],
      "variable": [
        {
          "key": "id",
          "value": "<long>",
          "description": "(Required) ID of document"
        }
      ]
    }
  },
  "response": [
    {
      "name": "Successful operation",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/pdf"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/documents/:id/pdf",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id",
            "pdf"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/pdf"
        }
      ],
      "cookie": [
      ],
      "body": "<string>"
    },
    {
      "name": "Not found",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/documents/:id/pdf",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id",
            "pdf"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Too Many Requests",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/documents/:id/pdf",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id",
            "pdf"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}