Chilkat Online Tools

Java / Egyptian eInvoicing SDK R1.5 / 7. Search my EGS code usage requests

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;

    CkJsonObject queryParams = new CkJsonObject();
    queryParams.UpdateString("Active","true");
    queryParams.UpdateString("Status","Approved");
    queryParams.UpdateInt("PageSize",10);
    queryParams.UpdateInt("PageNumber",1);
    queryParams.UpdateString("OrderDirections","Descending");

    // Adds the "Authorization: Bearer <access_token>" header.
    http.put_AuthToken("<access_token>");
    http.SetRequestHeader("Accept-Language","en");

    CkHttpResponse resp = http.QuickRequestParams("GET","https://domain.com/api/v1.0/codetypes/requests/my",queryParams);
    if (http.get_LastMethodSuccess() == false) {
        System.out.println(http.lastErrorText());
        return;
        }

    System.out.println(resp.get_StatusCode());
    System.out.println(resp.bodyStr());
  }
}

Curl Command

curl -G -d "Active=true"
	-d "Status=Approved"
	-d "PageSize=10"
	-d "PageNumber=1"
	-d "OrderDirections=Descending"
	-H "Authorization: Bearer <access_token>"
	-H "Accept-Language: en"
https://domain.com/api/v1.0/codetypes/requests/my

Postman Collection Item JSON

{
  "name": "7. Search my EGS code usage requests",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{generatedAccessToken}}",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
      {
        "key": "Accept-Language",
        "value": "en",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{apiBaseUrl}}/api/v1.0/codetypes/requests/my?Active=true&Status=Approved&PageSize=10&PageNumber=1&OrderDirections=Descending",
      "host": [
        "{{apiBaseUrl}}"
      ],
      "path": [
        "api",
        "v1.0",
        "codetypes",
        "requests",
        "my"
      ],
      "query": [
        {
          "key": "ItemCode",
          "value": "EG-100027962-1208617",
          "disabled": true
        },
        {
          "key": "CodeName",
          "value": "Code Name",
          "disabled": true
        },
        {
          "key": "CodeDescription",
          "value": "Perf Test Desc",
          "disabled": true
        },
        {
          "key": "ParentLevelName",
          "value": "EGS Level 4 Code",
          "disabled": true
        },
        {
          "key": "ParentItemCode",
          "value": "100000",
          "disabled": true
        },
        {
          "key": "ActiveFrom",
          "value": "2021-03-21T00:00:00Z",
          "disabled": true
        },
        {
          "key": "ActiveTo",
          "value": "2021-05-21T23:59:00Z",
          "disabled": true
        },
        {
          "key": "Active",
          "value": "true"
        },
        {
          "key": "Status",
          "value": "Approved"
        },
        {
          "key": "PageSize",
          "value": "10"
        },
        {
          "key": "PageNumber",
          "value": "1"
        },
        {
          "key": "OrderDirections",
          "value": "Descending"
        },
        {
          "key": "RequestType",
          "value": "New",
          "disabled": true
        }
      ]
    }
  },
  "response": [
  ]
}