Chilkat Online Tools

PowerBuilder / EDS API / Dokuments "Pārskats par tiešo nodokļu atlaidēm un atbalstu ieguldījumu veikšanai".

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_IeguldSumma
string ls_Kods
string ls_NINA
string ls_UINA
string ls_IeguldNos
integer li_AtlProcents
string ls_Value
string ls_Komentars
string ls_TaksNo
string ls_TaksLidz
string ls_Epasts
string ls_Talrunis
string ls_Sagatavotajs
string ls_R021
string ls_R022
string ls_R023
string ls_R027Proc
string ls_R027
string ls_R028
string ls_R029Proc
string ls_R029
string ls_R031
string ls_R032
string ls_R041
string ls_R042
string ls_R043
string ls_R044
string ls_R045
string ls_R046
string ls_R047
string ls_R048Text
string ls_R048
string ls_R05
string ls_R06
string ls_R07
string ls_R081
string ls_R082
string ls_R083
integer li_Id
string ls_UID
string ls_NmrKods
integer li_Precizejums
integer li_PrecizejamaisDokuments
string ls_PrecizejumaPamatojums
integer i
integer li_Count_i

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

loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_Http.SetRequestHeader("Accept","application/json")

loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")

li_Success = loo_Http.QuickGetSb("https://eds.vid.gov.lv/api/doc/tnav2/:id",loo_SbResponseBody)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_SbResponseBody
    return
end if

loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Http.LastHeader
    Write-Debug "Failed."
    destroy loo_Http
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

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

// {
//   "TaksNo": "2000-01-31T00:00:00",
//   "TaksLidz": "2000-01-31T00:00:00",
//   "Epasts": "sed",
//   "Talrunis": "Duis u",
//   "Sagatavotajs": "culpa",
//   "R021": 20315906.116601974,
//   "R022": -61851466.616407834,
//   "R023": -3784754.811457798,
//   "R027Proc": -43191991.81540565,
//   "R027": 81749181.92572099,
//   "R028": 89221232.42839152,
//   "R029Proc": 87194117.8460764,
//   "R029": -2589640.38362439,
//   "R031": 60624455.21640742,
//   "R032": 63693008.897661984,
//   "R041": 55072033.556542635,
//   "R042": -74719243.59231457,
//   "R043": -49153745.67511059,
//   "R044": 77388360.48374161,
//   "R045": 93163563.6837829,
//   "R046": -11213941.923736036,
//   "R047": 40192475.45927173,
//   "R048Text": "quis in",
//   "R048": -85044547.56044617,
//   "R05": -20502042.2216855,
//   "R06": 18732287.88817753,
//   "R07": 44739889.77206805,
//   "R081": 96001089.93872571,
//   "R082": -76951175.44924127,
//   "R083": 2955251.3419849128,
//   "R09_Tabula": [
//     {
//       "IeguldSumma": 86276282.75377223,
//       "Kods": "officia nostrud cillum labore"
//     },
//     {
//       "IeguldSumma": 28942915.74151948,
//       "Kods": "aliqua"
//     }
//   ],
//   "R10_Tabula": [
//     {
//       "IeguldSumma": -31721504.967451915,
//       "Kods": "esse culpa "
//     },
//     {
//       "IeguldSumma": -58642566.252877384,
//       "Kods": "dolore aliqua quis"
//     }
//   ],
//   "R11_Tabula": [
//     {
//       "IeguldSumma": 81499190.51709351,
//       "Kods": "dolor aliquip occaecat do ea"
//     },
//     {
//       "IeguldSumma": 76755454.40086395,
//       "Kods": "nostrud"
//     }
//   ],
//   "R12_Tabula": [
//     {
//       "NINA": 79796877.36835039,
//       "UINA": 30331571.006744444,
//       "Kods": "irure in et ex",
//       "IeguldSumma": 54630688.33858213
//     },
//     {
//       "NINA": -6240697.226656616,
//       "UINA": 23590322.479562834,
//       "Kods": "consequat do ut",
//       "IeguldSumma": 63786168.45582652
//     }
//   ],
//   "R13_Tabula": [
//     {
//       "IeguldSumma": 30523200.60888873,
//       "Kods": "pariatur occaecat nostrud eu"
//     },
//     {
//       "IeguldSumma": -86174886.3759622,
//       "Kods": "Lorem sunt"
//     }
//   ],
//   "Ieguldijumi1": [
//     {
//       "Kods": "adipisicing deserunt nisi",
//       "IeguldNos": "sit nulla irure nisi",
//       "IeguldSumma": 24879133.12293549
//     },
//     {
//       "Kods": "tempor in voluptate",
//       "IeguldNos": "in incididunt Excepteur",
//       "IeguldSumma": -46005550.41745236
//     }
//   ],
//   "Ieguldijumi2": [
//     {
//       "Kods": "cupidatat Lorem consectetur",
//       "IeguldNos": "Duis",
//       "AtlProcents": 80216092,
//       "IeguldSumma": 74086661.08514467
//     },
//     {
//       "Kods": "ipsum anim amet",
//       "IeguldNos": "in fugiat voluptate et eu",
//       "AtlProcents": 44814656,
//       "IeguldSumma": -63030813.24776003
//     }
//   ],
//   "Pielikumi": [
//     {
//       "Fails": {
//         "value": "<Error: Too many levels of nesting to fake this schema>"
//       },
//       "Komentars": "reprehenderit culpa qui sed"
//     },
//     {
//       "Fails": {
//         "value": "<Error: Too many levels of nesting to fake this schema>"
//       },
//       "Komentars": "sunt proident"
//     }
//   ],
//   "Id": -54089874,
//   "UID": "aliquip culpa",
//   "NmrKods": "nisi ",
//   "Precizejums": true,
//   "PrecizejamaisDokuments": -6713016,
//   "PrecizejumaPamatojums": "anim ex"
// }

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

ls_TaksNo = loo_JResp.StringOf("TaksNo")
ls_TaksLidz = loo_JResp.StringOf("TaksLidz")
ls_Epasts = loo_JResp.StringOf("Epasts")
ls_Talrunis = loo_JResp.StringOf("Talrunis")
ls_Sagatavotajs = loo_JResp.StringOf("Sagatavotajs")
ls_R021 = loo_JResp.StringOf("R021")
ls_R022 = loo_JResp.StringOf("R022")
ls_R023 = loo_JResp.StringOf("R023")
ls_R027Proc = loo_JResp.StringOf("R027Proc")
ls_R027 = loo_JResp.StringOf("R027")
ls_R028 = loo_JResp.StringOf("R028")
ls_R029Proc = loo_JResp.StringOf("R029Proc")
ls_R029 = loo_JResp.StringOf("R029")
ls_R031 = loo_JResp.StringOf("R031")
ls_R032 = loo_JResp.StringOf("R032")
ls_R041 = loo_JResp.StringOf("R041")
ls_R042 = loo_JResp.StringOf("R042")
ls_R043 = loo_JResp.StringOf("R043")
ls_R044 = loo_JResp.StringOf("R044")
ls_R045 = loo_JResp.StringOf("R045")
ls_R046 = loo_JResp.StringOf("R046")
ls_R047 = loo_JResp.StringOf("R047")
ls_R048Text = loo_JResp.StringOf("R048Text")
ls_R048 = loo_JResp.StringOf("R048")
ls_R05 = loo_JResp.StringOf("R05")
ls_R06 = loo_JResp.StringOf("R06")
ls_R07 = loo_JResp.StringOf("R07")
ls_R081 = loo_JResp.StringOf("R081")
ls_R082 = loo_JResp.StringOf("R082")
ls_R083 = loo_JResp.StringOf("R083")
li_Id = loo_JResp.IntOf("Id")
ls_UID = loo_JResp.StringOf("UID")
ls_NmrKods = loo_JResp.StringOf("NmrKods")
li_Precizejums = loo_JResp.BoolOf("Precizejums")
li_PrecizejamaisDokuments = loo_JResp.IntOf("PrecizejamaisDokuments")
ls_PrecizejumaPamatojums = loo_JResp.StringOf("PrecizejumaPamatojums")
i = 0
li_Count_i = loo_JResp.SizeOfArray("R09_Tabula")
do while i < li_Count_i
    loo_JResp.I = i
    ls_IeguldSumma = loo_JResp.StringOf("R09_Tabula[i].IeguldSumma")
    ls_Kods = loo_JResp.StringOf("R09_Tabula[i].Kods")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("R10_Tabula")
do while i < li_Count_i
    loo_JResp.I = i
    ls_IeguldSumma = loo_JResp.StringOf("R10_Tabula[i].IeguldSumma")
    ls_Kods = loo_JResp.StringOf("R10_Tabula[i].Kods")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("R11_Tabula")
do while i < li_Count_i
    loo_JResp.I = i
    ls_IeguldSumma = loo_JResp.StringOf("R11_Tabula[i].IeguldSumma")
    ls_Kods = loo_JResp.StringOf("R11_Tabula[i].Kods")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("R12_Tabula")
do while i < li_Count_i
    loo_JResp.I = i
    ls_NINA = loo_JResp.StringOf("R12_Tabula[i].NINA")
    ls_UINA = loo_JResp.StringOf("R12_Tabula[i].UINA")
    ls_Kods = loo_JResp.StringOf("R12_Tabula[i].Kods")
    ls_IeguldSumma = loo_JResp.StringOf("R12_Tabula[i].IeguldSumma")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("R13_Tabula")
do while i < li_Count_i
    loo_JResp.I = i
    ls_IeguldSumma = loo_JResp.StringOf("R13_Tabula[i].IeguldSumma")
    ls_Kods = loo_JResp.StringOf("R13_Tabula[i].Kods")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("Ieguldijumi1")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Kods = loo_JResp.StringOf("Ieguldijumi1[i].Kods")
    ls_IeguldNos = loo_JResp.StringOf("Ieguldijumi1[i].IeguldNos")
    ls_IeguldSumma = loo_JResp.StringOf("Ieguldijumi1[i].IeguldSumma")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("Ieguldijumi2")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Kods = loo_JResp.StringOf("Ieguldijumi2[i].Kods")
    ls_IeguldNos = loo_JResp.StringOf("Ieguldijumi2[i].IeguldNos")
    li_AtlProcents = loo_JResp.IntOf("Ieguldijumi2[i].AtlProcents")
    ls_IeguldSumma = loo_JResp.StringOf("Ieguldijumi2[i].IeguldSumma")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("Pielikumi")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Value = loo_JResp.StringOf("Pielikumi[i].Fails.value")
    ls_Komentars = loo_JResp.StringOf("Pielikumi[i].Komentars")
    i = i + 1
loop


destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

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

Postman Collection Item JSON

{
  "name": "Dokuments \"Pārskats par tiešo nodokļu atlaidēm un atbalstu ieguldījumu veikšanai\".",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/doc/tnav2/:id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "doc",
        "tnav2",
        ":id"
      ],
      "variable": [
        {
          "key": "id",
          "value": "25210683",
          "description": "(Required) Dokumenta id."
        }
      ]
    }
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/doc/tnav2/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "tnav2",
            ":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  \"TaksNo\": \"2000-01-31T00:00:00\",\n  \"TaksLidz\": \"2000-01-31T00:00:00\",\n  \"Epasts\": \"sed\",\n  \"Talrunis\": \"Duis u\",\n  \"Sagatavotajs\": \"culpa\",\n  \"R021\": 20315906.116601974,\n  \"R022\": -61851466.616407834,\n  \"R023\": -3784754.811457798,\n  \"R027Proc\": -43191991.81540565,\n  \"R027\": 81749181.92572099,\n  \"R028\": 89221232.42839152,\n  \"R029Proc\": 87194117.8460764,\n  \"R029\": -2589640.38362439,\n  \"R031\": 60624455.21640742,\n  \"R032\": 63693008.897661984,\n  \"R041\": 55072033.556542635,\n  \"R042\": -74719243.59231457,\n  \"R043\": -49153745.67511059,\n  \"R044\": 77388360.48374161,\n  \"R045\": 93163563.6837829,\n  \"R046\": -11213941.923736036,\n  \"R047\": 40192475.45927173,\n  \"R048Text\": \"quis in\",\n  \"R048\": -85044547.56044617,\n  \"R05\": -20502042.2216855,\n  \"R06\": 18732287.88817753,\n  \"R07\": 44739889.77206805,\n  \"R081\": 96001089.93872571,\n  \"R082\": -76951175.44924127,\n  \"R083\": 2955251.3419849128,\n  \"R09_Tabula\": [\n    {\n      \"IeguldSumma\": 86276282.75377223,\n      \"Kods\": \"officia nostrud cillum labore\"\n    },\n    {\n      \"IeguldSumma\": 28942915.74151948,\n      \"Kods\": \"aliqua\"\n    }\n  ],\n  \"R10_Tabula\": [\n    {\n      \"IeguldSumma\": -31721504.967451915,\n      \"Kods\": \"esse culpa \"\n    },\n    {\n      \"IeguldSumma\": -58642566.252877384,\n      \"Kods\": \"dolore aliqua quis\"\n    }\n  ],\n  \"R11_Tabula\": [\n    {\n      \"IeguldSumma\": 81499190.51709351,\n      \"Kods\": \"dolor aliquip occaecat do ea\"\n    },\n    {\n      \"IeguldSumma\": 76755454.40086395,\n      \"Kods\": \"nostrud\"\n    }\n  ],\n  \"R12_Tabula\": [\n    {\n      \"NINA\": 79796877.36835039,\n      \"UINA\": 30331571.006744444,\n      \"Kods\": \"irure in et ex\",\n      \"IeguldSumma\": 54630688.33858213\n    },\n    {\n      \"NINA\": -6240697.226656616,\n      \"UINA\": 23590322.479562834,\n      \"Kods\": \"consequat do ut\",\n      \"IeguldSumma\": 63786168.45582652\n    }\n  ],\n  \"R13_Tabula\": [\n    {\n      \"IeguldSumma\": 30523200.60888873,\n      \"Kods\": \"pariatur occaecat nostrud eu\"\n    },\n    {\n      \"IeguldSumma\": -86174886.3759622,\n      \"Kods\": \"Lorem sunt\"\n    }\n  ],\n  \"Ieguldijumi1\": [\n    {\n      \"Kods\": \"adipisicing deserunt nisi\",\n      \"IeguldNos\": \"sit nulla irure nisi\",\n      \"IeguldSumma\": 24879133.12293549\n    },\n    {\n      \"Kods\": \"tempor in voluptate\",\n      \"IeguldNos\": \"in incididunt Excepteur\",\n      \"IeguldSumma\": -46005550.41745236\n    }\n  ],\n  \"Ieguldijumi2\": [\n    {\n      \"Kods\": \"cupidatat Lorem consectetur\",\n      \"IeguldNos\": \"Duis\",\n      \"AtlProcents\": 80216092,\n      \"IeguldSumma\": 74086661.08514467\n    },\n    {\n      \"Kods\": \"ipsum anim amet\",\n      \"IeguldNos\": \"in fugiat voluptate et eu\",\n      \"AtlProcents\": 44814656,\n      \"IeguldSumma\": -63030813.24776003\n    }\n  ],\n  \"Pielikumi\": [\n    {\n      \"Fails\": {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"Komentars\": \"reprehenderit culpa qui sed\"\n    },\n    {\n      \"Fails\": {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"Komentars\": \"sunt proident\"\n    }\n  ],\n  \"Id\": -54089874,\n  \"UID\": \"aliquip culpa\",\n  \"NmrKods\": \"nisi \",\n  \"Precizejums\": true,\n  \"PrecizejamaisDokuments\": -6713016,\n  \"PrecizejumaPamatojums\": \"anim ex\"\n}"
    },
    {
      "name": "Lietotājs nav autentificēts.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/doc/tnav2/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "tnav2",
            ":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/tnav2/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "tnav2",
            ":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/tnav2/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "tnav2",
            ":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": ""
    }
  ]
}