Chilkat Online Tools

delphiDll / EDS API / Dokuments "Pārskata perioda deklarācija par ienākumu no kapitāla pieauguma - DK veidlapa".

Back to Collection Items

var
http: HCkHttp;
success: Boolean;
sbResponseBody: HCkStringBuilder;
jResp: HCkJsonObject;
respStatusCode: Integer;
IenDiena: PWideChar;
IenVeids: PWideChar;
IenKapAtsav: PWideChar;
IzdKapIegade: PWideChar;
Rokasnauda: Boolean;
f: Boolean;
l: Boolean;
IenDala: PWideChar;
AttiecDala: PWideChar;
NodoklisArv: PWideChar;
Apliekamais: PWideChar;
NodoklaLikme: PWideChar;
Nodoklis: PWideChar;
Value: PWideChar;
Komentars: PWideChar;
Gads: Integer;
Ceturksnis: Integer;
Epasts: PWideChar;
Talrunis: PWideChar;
Menesis: Integer;
Nerezidents: Boolean;
Sagatavotajs: PWideChar;
IenKapAtsavKopa: PWideChar;
IenDalaKopa: PWideChar;
IzdKapIegadeKopa: PWideChar;
AttiecDalaKopa: PWideChar;
NodoklisArvKopa: PWideChar;
ApliekamaisKopa: PWideChar;
NodoklisKopa: PWideChar;
Id: Integer;
UID: PWideChar;
NmrKods: PWideChar;
Precizejums: Boolean;
PrecizejamaisDokuments: Integer;
PrecizejumaPamatojums: PWideChar;
i: Integer;
count_i: Integer;

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

http := CkHttp_Create();

CkHttp_SetRequestHeader(http,'Accept','application/json');

sbResponseBody := CkStringBuilder_Create();
success := CkHttp_QuickGetSb(http,'https://eds.vid.gov.lv/api/doc/dkv5/:id',sbResponseBody);
if (success = False) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Exit;
  end;

jResp := CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
CkJsonObject_putEmitCompact(jResp,False);

Memo1.Lines.Add('Response Body:');
Memo1.Lines.Add(CkJsonObject__emit(jResp));

respStatusCode := CkHttp_getLastStatus(http);
Memo1.Lines.Add('Response Status Code = ' + IntToStr(respStatusCode));
if (respStatusCode >= 400) then
  begin
    Memo1.Lines.Add('Response Header:');
    Memo1.Lines.Add(CkHttp__lastHeader(http));
    Memo1.Lines.Add('Failed.');
    Exit;
  end;

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "Gads": -61584328,
//   "Ceturksnis": 2,
//   "Epasts": "",
//   "Talrunis": "quis aute ",
//   "Menesis": 6,
//   "Nerezidents": true,
//   "Sagatavotajs": "aute ea",
//   "Tabula": [
//     {
//       "IenDiena": "2000-01-31T00:00:00",
//       "IenVeids": "ad sunt occaecat sint",
//       "IenKapAtsav": 19792624.554944023,
//       "IzdKapIegade": 50586860.273299366,
//       "Rokasnauda": false,
//       "f": true,
//       "l": false,
//       "IenDala": -66321869.19235421,
//       "AttiecDala": 28338763.96240291,
//       "NodoklisArv": 64925845.39672279,
//       "Apliekamais": 38871457.55627382,
//       "NodoklaLikme": 78048164.78236377,
//       "Nodoklis": -69173325.96784113
//     },
//     {
//       "IenDiena": "2000-01-31T00:00:00",
//       "IenVeids": "ea officia veniam s",
//       "IenKapAtsav": 66568302.260939986,
//       "IzdKapIegade": -68265245.33776514,
//       "Rokasnauda": true,
//       "f": true,
//       "l": true,
//       "IenDala": -68564351.41005428,
//       "AttiecDala": 50315053.6464974,
//       "NodoklisArv": -57723279.69034201,
//       "Apliekamais": 4921203.848669723,
//       "NodoklaLikme": -41705366.422067724,
//       "Nodoklis": -64341384.32557477
//     }
//   ],
//   "IenKapAtsavKopa": 99855406.01113215,
//   "IenDalaKopa": -42042965.98403743,
//   "IzdKapIegadeKopa": -17762811.825425968,
//   "AttiecDalaKopa": 50013080.066836625,
//   "NodoklisArvKopa": 75274983.84032097,
//   "ApliekamaisKopa": -78659021.824138,
//   "NodoklisKopa": -36741800.4278655,
//   "Pielikumi": [
//     {
//       "Fails": {
//         "value": "<Error: Too many levels of nesting to fake this schema>"
//       },
//       "Komentars": "est velit"
//     },
//     {
//       "Fails": {
//         "value": "<Error: Too many levels of nesting to fake this schema>"
//       },
//       "Komentars": "in"
//     }
//   ],
//   "Id": 86830406,
//   "UID": "id ",
//   "NmrKods": "proi",
//   "Precizejums": true,
//   "PrecizejamaisDokuments": -9668406,
//   "PrecizejumaPamatojums": "elit nisi in"
// }

// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

Gads := CkJsonObject_IntOf(jResp,'Gads');
Ceturksnis := CkJsonObject_IntOf(jResp,'Ceturksnis');
Epasts := CkJsonObject__stringOf(jResp,'Epasts');
Talrunis := CkJsonObject__stringOf(jResp,'Talrunis');
Menesis := CkJsonObject_IntOf(jResp,'Menesis');
Nerezidents := CkJsonObject_BoolOf(jResp,'Nerezidents');
Sagatavotajs := CkJsonObject__stringOf(jResp,'Sagatavotajs');
IenKapAtsavKopa := CkJsonObject__stringOf(jResp,'IenKapAtsavKopa');
IenDalaKopa := CkJsonObject__stringOf(jResp,'IenDalaKopa');
IzdKapIegadeKopa := CkJsonObject__stringOf(jResp,'IzdKapIegadeKopa');
AttiecDalaKopa := CkJsonObject__stringOf(jResp,'AttiecDalaKopa');
NodoklisArvKopa := CkJsonObject__stringOf(jResp,'NodoklisArvKopa');
ApliekamaisKopa := CkJsonObject__stringOf(jResp,'ApliekamaisKopa');
NodoklisKopa := CkJsonObject__stringOf(jResp,'NodoklisKopa');
Id := CkJsonObject_IntOf(jResp,'Id');
UID := CkJsonObject__stringOf(jResp,'UID');
NmrKods := CkJsonObject__stringOf(jResp,'NmrKods');
Precizejums := CkJsonObject_BoolOf(jResp,'Precizejums');
PrecizejamaisDokuments := CkJsonObject_IntOf(jResp,'PrecizejamaisDokuments');
PrecizejumaPamatojums := CkJsonObject__stringOf(jResp,'PrecizejumaPamatojums');
i := 0;
count_i := CkJsonObject_SizeOfArray(jResp,'Tabula');
while i < count_i do
  begin
    CkJsonObject_putI(jResp,i);
    IenDiena := CkJsonObject__stringOf(jResp,'Tabula[i].IenDiena');
    IenVeids := CkJsonObject__stringOf(jResp,'Tabula[i].IenVeids');
    IenKapAtsav := CkJsonObject__stringOf(jResp,'Tabula[i].IenKapAtsav');
    IzdKapIegade := CkJsonObject__stringOf(jResp,'Tabula[i].IzdKapIegade');
    Rokasnauda := CkJsonObject_BoolOf(jResp,'Tabula[i].Rokasnauda');
    f := CkJsonObject_BoolOf(jResp,'Tabula[i].f');
    l := CkJsonObject_BoolOf(jResp,'Tabula[i].l');
    IenDala := CkJsonObject__stringOf(jResp,'Tabula[i].IenDala');
    AttiecDala := CkJsonObject__stringOf(jResp,'Tabula[i].AttiecDala');
    NodoklisArv := CkJsonObject__stringOf(jResp,'Tabula[i].NodoklisArv');
    Apliekamais := CkJsonObject__stringOf(jResp,'Tabula[i].Apliekamais');
    NodoklaLikme := CkJsonObject__stringOf(jResp,'Tabula[i].NodoklaLikme');
    Nodoklis := CkJsonObject__stringOf(jResp,'Tabula[i].Nodoklis');
    i := i + 1;
  end;

i := 0;
count_i := CkJsonObject_SizeOfArray(jResp,'Pielikumi');
while i < count_i do
  begin
    CkJsonObject_putI(jResp,i);
    Value := CkJsonObject__stringOf(jResp,'Pielikumi[i].Fails.value');
    Komentars := CkJsonObject__stringOf(jResp,'Pielikumi[i].Komentars');
    i := i + 1;
  end;

CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);

Curl Command

curl -X GET
	-H "Accept: application/json"
https://eds.vid.gov.lv/api/doc/dkv5/:id

Postman Collection Item JSON

{
  "name": "Dokuments \"Pārskata perioda deklarācija par ienākumu no kapitāla pieauguma - DK veidlapa\".",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/doc/dkv5/:id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "doc",
        "dkv5",
        ":id"
      ],
      "variable": [
        {
          "key": "id",
          "value": "25210683",
          "description": "(Required) Dokumenta id."
        }
      ]
    }
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/doc/dkv5/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "dkv5",
            ":id"
          ],
          "variable": [
            {
              "key": "id",
              "value": "25210683",
              "description": "(Required) Dokumenta id."
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"Gads\": -61584328,\n  \"Ceturksnis\": 2,\n  \"Epasts\": \"\",\n  \"Talrunis\": \"quis aute \",\n  \"Menesis\": 6,\n  \"Nerezidents\": true,\n  \"Sagatavotajs\": \"aute ea\",\n  \"Tabula\": [\n    {\n      \"IenDiena\": \"2000-01-31T00:00:00\",\n      \"IenVeids\": \"ad sunt occaecat sint\",\n      \"IenKapAtsav\": 19792624.554944023,\n      \"IzdKapIegade\": 50586860.273299366,\n      \"Rokasnauda\": false,\n      \"f\": true,\n      \"l\": false,\n      \"IenDala\": -66321869.19235421,\n      \"AttiecDala\": 28338763.96240291,\n      \"NodoklisArv\": 64925845.39672279,\n      \"Apliekamais\": 38871457.55627382,\n      \"NodoklaLikme\": 78048164.78236377,\n      \"Nodoklis\": -69173325.96784113\n    },\n    {\n      \"IenDiena\": \"2000-01-31T00:00:00\",\n      \"IenVeids\": \"ea officia veniam s\",\n      \"IenKapAtsav\": 66568302.260939986,\n      \"IzdKapIegade\": -68265245.33776514,\n      \"Rokasnauda\": true,\n      \"f\": true,\n      \"l\": true,\n      \"IenDala\": -68564351.41005428,\n      \"AttiecDala\": 50315053.6464974,\n      \"NodoklisArv\": -57723279.69034201,\n      \"Apliekamais\": 4921203.848669723,\n      \"NodoklaLikme\": -41705366.422067724,\n      \"Nodoklis\": -64341384.32557477\n    }\n  ],\n  \"IenKapAtsavKopa\": 99855406.01113215,\n  \"IenDalaKopa\": -42042965.98403743,\n  \"IzdKapIegadeKopa\": -17762811.825425968,\n  \"AttiecDalaKopa\": 50013080.066836625,\n  \"NodoklisArvKopa\": 75274983.84032097,\n  \"ApliekamaisKopa\": -78659021.824138,\n  \"NodoklisKopa\": -36741800.4278655,\n  \"Pielikumi\": [\n    {\n      \"Fails\": {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"Komentars\": \"est velit\"\n    },\n    {\n      \"Fails\": {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"Komentars\": \"in\"\n    }\n  ],\n  \"Id\": 86830406,\n  \"UID\": \"id \",\n  \"NmrKods\": \"proi\",\n  \"Precizejums\": true,\n  \"PrecizejamaisDokuments\": -9668406,\n  \"PrecizejumaPamatojums\": \"elit nisi in\"\n}"
    },
    {
      "name": "Lietotājs nav autentificēts.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/doc/dkv5/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "dkv5",
            ":id"
          ],
          "variable": [
            {
              "key": "id",
              "value": "25210683",
              "description": "(Required) Dokumenta id."
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Dokuments neeksistē vai lietotājam nav tiesību.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/doc/dkv5/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "dkv5",
            ":id"
          ],
          "variable": [
            {
              "key": "id",
              "value": "25210683",
              "description": "(Required) Dokumenta id."
            }
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Pārsniegts izsaukumu skaita ierobežojums.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/doc/dkv5/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "dkv5",
            ":id"
          ],
          "variable": [
            {
              "key": "id",
              "value": "25210683",
              "description": "(Required) Dokumenta id."
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}