Chilkat Online Tools

ERROR!

------------------- GenerateCode ----------------------
ImpliedContentType: 
---- 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;

new JsonObject queryParams;
ignore = queryParams.UpdateString("offset","<long>");
ignore = queryParams.UpdateString("limit","<long>");

call http.SetRequestHeader("Authorization","{{apiKey}}");
call http.SetRequestHeader("Accept","image/jpeg");


HttpResponse resp = http.QuickRequestParams("GET","https://api.easybill.de/rest/v1/documents/:id/jpg",queryParams);
if (http.LastMethodSuccess == ckfalse) {
    println http.LastErrorText;
    return;
}

ERROR: ExpectedResponseType not yet supported...
ExpectedResponseType: [image/jpeg]
m_reqType = 9
ERROR: Something in the response processing not yet supported...

---- end chilkat script ----

Android / easybill REST API / Download a document as an jpeg-image

Back to Collection Items

// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;

import android.app.Activity;
import com.chilkatsoft.*;

import android.widget.TextView;
import android.os.Bundle;

public class SimpleActivity extends Activity {

  private static final String TAG = "Chilkat";

  // Called when the activity is first created.
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

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

    CkHttp http = new CkHttp();
    boolean success;

    CkJsonObject queryParams = new CkJsonObject();
    queryParams.UpdateString("offset","<long>");
    queryParams.UpdateString("limit","<long>");

    http.SetRequestHeader("Authorization","{{apiKey}}");
    http.SetRequestHeader("Accept","image/jpeg");

    CkHttpResponse resp = http.QuickRequestParams("GET","https://api.easybill.de/rest/v1/documents/:id/jpg",queryParams);
    if (http.get_LastMethodSuccess() == false) {
        Log.i(TAG, http.lastErrorText());
        return;
        }

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

  }

  static {
      System.loadLibrary("chilkat");

      // Note: If the incorrect library name is passed to System.loadLibrary,
      // then you will see the following error message at application startup:
      //"The application <your-application-name> has stopped unexpectedly. Please try again."
  }
}

Curl Command

curl -G -d "offset=%3Clong%3E"
	-d "limit=%3Clong%3E"
	-H "Authorization: {{apiKey}}"
	-H "Accept: image/jpeg"
https://api.easybill.de/rest/v1/documents/:id/jpg

Postman Collection Item JSON

{
  "name": "Download a document as an jpeg-image",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "image/jpeg"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/documents/:id/jpg?offset=<long>&limit=<long>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "documents",
        ":id",
        "jpg"
      ],
      "query": [
        {
          "key": "offset",
          "value": "<long>",
          "description": "The page of the document where the image should start."
        },
        {
          "key": "limit",
          "value": "<long>",
          "description": "The page of the document where the image should end."
        }
      ],
      "variable": [
        {
          "key": "id",
          "value": "<long>",
          "description": "(Required) ID of document"
        }
      ]
    }
  },
  "response": [
    {
      "name": "Successful operation",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "image/jpeg"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/documents/:id/jpg?offset=<long>&limit=<long>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id",
            "jpg"
          ],
          "query": [
            {
              "key": "offset",
              "value": "<long>",
              "description": "The page of the document where the image should start."
            },
            {
              "key": "limit",
              "value": "<long>",
              "description": "The page of the document where the image should end."
            }
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "image/jpeg"
        }
      ],
      "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/jpg?offset=<long>&limit=<long>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id",
            "jpg"
          ],
          "query": [
            {
              "key": "offset",
              "value": "<long>",
              "description": "The page of the document where the image should start."
            },
            {
              "key": "limit",
              "value": "<long>",
              "description": "The page of the document where the image should end."
            }
          ],
          "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/jpg?offset=<long>&limit=<long>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "documents",
            ":id",
            "jpg"
          ],
          "query": [
            {
              "key": "offset",
              "value": "<long>",
              "description": "The page of the document where the image should start."
            },
            {
              "key": "limit",
              "value": "<long>",
              "description": "The page of the document where the image should end."
            }
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}