Chilkat Online Tools

PowerBuilder / EDS API / Dokuments "IeIeN pārskats par izmaksām nerezidentiem".

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Vards
string ls_Uzvards
string ls_Valsts
string ls_AdrIela
string ls_AdrPilseta
string ls_AdrPasts
string ls_IenVeids
integer li_IzmDatums
string ls_IenSumma
string ls_NodLikme
string ls_NodSumma
string ls_CitsPersKods
string ls_LrNmrKods
string ls_DzimDatums
string ls_ATVK
string ls_JpKods
string ls_JpNosaukums
string ls_Piezimes
integer li_ParskGads
string ls_Epasts
string ls_Talrunis
string ls_ParskMen
string ls_Sagatavotajs
string ls_NmrKods
integer li_Id
string ls_UID
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/inrv2/: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)

// {
//   "ParskGads": 54743069,
//   "Epasts": "magna ad nostrud occaecat",
//   "Talrunis": "laboris mollit",
//   "ParskMen": "commodo deserunt",
//   "Sagatavotajs": "dolore nulla",
//   "NmrKods": "nostrud su",
//   "TabulaFP": [
//     {
//       "Vards": "in",
//       "Uzvards": "sunt in",
//       "Valsts": "in laborum in ullamco",
//       "AdrIela": "officia",
//       "AdrPilseta": "officia aute ad magna do",
//       "AdrPasts": "elit dolor",
//       "IenVeids": "velit adipisicing in Excepteur",
//       "IzmDatums": 17,
//       "IenSumma": -5811443.522479072,
//       "NodLikme": 23853015.107451633,
//       "NodSumma": -35352699.91027565,
//       "CitsPersKods": "Excepteur fugiat",
//       "LrNmrKods": "e",
//       "DzimDatums": "2000-01-31T00:00:00",
//       "ATVK": "enim non ipsum"
//     },
//     {
//       "Vards": "voluptate cillum laborum",
//       "Uzvards": "ut velit aliquip occaecat nulla",
//       "Valsts": "officia reprehenderit sint",
//       "AdrIela": "dese",
//       "AdrPilseta": "eu sunt",
//       "AdrPasts": "et",
//       "IenVeids": "fugiat eu",
//       "IzmDatums": 16,
//       "IenSumma": -3921734.7059562653,
//       "NodLikme": 23938705.79623814,
//       "NodSumma": -17258687.90274711,
//       "CitsPersKods": "sunt minim",
//       "LrNmrKods": "eu",
//       "DzimDatums": "2000-01-31T00:00:00",
//       "ATVK": "ea nisi irure"
//     }
//   ],
//   "TabulaJP": [
//     {
//       "Valsts": "ipsum eu id ea",
//       "AdrIela": "nisi mollit irure Excepteur",
//       "AdrPilseta": "cillum laborum",
//       "AdrPasts": "dolor cupidata",
//       "IenVeids": "fugiat ex consequat",
//       "IzmDatums": 29,
//       "IenSumma": 35501102.52214521,
//       "NodLikme": -40720481.84149244,
//       "NodSumma": 73375233.76676768,
//       "JpKods": "mollit est Lorem aute",
//       "JpNosaukums": "fugiat consequa",
//       "Piezimes": "veniam in",
//       "ATVK": "veniam reprehenderit esse adipisicing"
//     },
//     {
//       "Valsts": "Excepteur deserunt",
//       "AdrIela": "adipisicing labore commodo cillum in",
//       "AdrPilseta": "labore non nostrud magna",
//       "AdrPasts": "ut fugiat occaecat ",
//       "IenVeids": "nisi ex commodo",
//       "IzmDatums": 24,
//       "IenSumma": -49006663.90657453,
//       "NodLikme": 32085369.934580848,
//       "NodSumma": -55044059.760223664,
//       "JpKods": "culpa voluptate dolor Duis sed",
//       "JpNosaukums": "fugiat quis occaecat qui",
//       "Piezimes": "culpa velit elit",
//       "ATVK": "Lorem voluptate aliqua ut"
//     }
//   ],
//   "Id": 9851816,
//   "UID": "officia incididunt quis",
//   "Precizejums": false,
//   "PrecizejamaisDokuments": -23042510,
//   "PrecizejumaPamatojums": "nostrud dolor"
// }

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

li_ParskGads = loo_JResp.IntOf("ParskGads")
ls_Epasts = loo_JResp.StringOf("Epasts")
ls_Talrunis = loo_JResp.StringOf("Talrunis")
ls_ParskMen = loo_JResp.StringOf("ParskMen")
ls_Sagatavotajs = loo_JResp.StringOf("Sagatavotajs")
ls_NmrKods = loo_JResp.StringOf("NmrKods")
li_Id = loo_JResp.IntOf("Id")
ls_UID = loo_JResp.StringOf("UID")
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("TabulaFP")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Vards = loo_JResp.StringOf("TabulaFP[i].Vards")
    ls_Uzvards = loo_JResp.StringOf("TabulaFP[i].Uzvards")
    ls_Valsts = loo_JResp.StringOf("TabulaFP[i].Valsts")
    ls_AdrIela = loo_JResp.StringOf("TabulaFP[i].AdrIela")
    ls_AdrPilseta = loo_JResp.StringOf("TabulaFP[i].AdrPilseta")
    ls_AdrPasts = loo_JResp.StringOf("TabulaFP[i].AdrPasts")
    ls_IenVeids = loo_JResp.StringOf("TabulaFP[i].IenVeids")
    li_IzmDatums = loo_JResp.IntOf("TabulaFP[i].IzmDatums")
    ls_IenSumma = loo_JResp.StringOf("TabulaFP[i].IenSumma")
    ls_NodLikme = loo_JResp.StringOf("TabulaFP[i].NodLikme")
    ls_NodSumma = loo_JResp.StringOf("TabulaFP[i].NodSumma")
    ls_CitsPersKods = loo_JResp.StringOf("TabulaFP[i].CitsPersKods")
    ls_LrNmrKods = loo_JResp.StringOf("TabulaFP[i].LrNmrKods")
    ls_DzimDatums = loo_JResp.StringOf("TabulaFP[i].DzimDatums")
    ls_ATVK = loo_JResp.StringOf("TabulaFP[i].ATVK")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("TabulaJP")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Valsts = loo_JResp.StringOf("TabulaJP[i].Valsts")
    ls_AdrIela = loo_JResp.StringOf("TabulaJP[i].AdrIela")
    ls_AdrPilseta = loo_JResp.StringOf("TabulaJP[i].AdrPilseta")
    ls_AdrPasts = loo_JResp.StringOf("TabulaJP[i].AdrPasts")
    ls_IenVeids = loo_JResp.StringOf("TabulaJP[i].IenVeids")
    li_IzmDatums = loo_JResp.IntOf("TabulaJP[i].IzmDatums")
    ls_IenSumma = loo_JResp.StringOf("TabulaJP[i].IenSumma")
    ls_NodLikme = loo_JResp.StringOf("TabulaJP[i].NodLikme")
    ls_NodSumma = loo_JResp.StringOf("TabulaJP[i].NodSumma")
    ls_JpKods = loo_JResp.StringOf("TabulaJP[i].JpKods")
    ls_JpNosaukums = loo_JResp.StringOf("TabulaJP[i].JpNosaukums")
    ls_Piezimes = loo_JResp.StringOf("TabulaJP[i].Piezimes")
    ls_ATVK = loo_JResp.StringOf("TabulaJP[i].ATVK")
    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/inrv2/:id

Postman Collection Item JSON

{
  "name": "Dokuments \"IeIeN pārskats par izmaksām nerezidentiem\".",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/doc/inrv2/:id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "doc",
        "inrv2",
        ":id"
      ],
      "variable": [
        {
          "key": "id",
          "value": "25210683",
          "description": "(Required) Dokumenta id."
        }
      ]
    }
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/doc/inrv2/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "inrv2",
            ":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  \"ParskGads\": 54743069,\n  \"Epasts\": \"magna ad nostrud occaecat\",\n  \"Talrunis\": \"laboris mollit\",\n  \"ParskMen\": \"commodo deserunt\",\n  \"Sagatavotajs\": \"dolore nulla\",\n  \"NmrKods\": \"nostrud su\",\n  \"TabulaFP\": [\n    {\n      \"Vards\": \"in\",\n      \"Uzvards\": \"sunt in\",\n      \"Valsts\": \"in laborum in ullamco\",\n      \"AdrIela\": \"officia\",\n      \"AdrPilseta\": \"officia aute ad magna do\",\n      \"AdrPasts\": \"elit dolor\",\n      \"IenVeids\": \"velit adipisicing in Excepteur\",\n      \"IzmDatums\": 17,\n      \"IenSumma\": -5811443.522479072,\n      \"NodLikme\": 23853015.107451633,\n      \"NodSumma\": -35352699.91027565,\n      \"CitsPersKods\": \"Excepteur fugiat\",\n      \"LrNmrKods\": \"e\",\n      \"DzimDatums\": \"2000-01-31T00:00:00\",\n      \"ATVK\": \"enim non ipsum\"\n    },\n    {\n      \"Vards\": \"voluptate cillum laborum\",\n      \"Uzvards\": \"ut velit aliquip occaecat nulla\",\n      \"Valsts\": \"officia reprehenderit sint\",\n      \"AdrIela\": \"dese\",\n      \"AdrPilseta\": \"eu sunt\",\n      \"AdrPasts\": \"et\",\n      \"IenVeids\": \"fugiat eu\",\n      \"IzmDatums\": 16,\n      \"IenSumma\": -3921734.7059562653,\n      \"NodLikme\": 23938705.79623814,\n      \"NodSumma\": -17258687.90274711,\n      \"CitsPersKods\": \"sunt minim\",\n      \"LrNmrKods\": \"eu\",\n      \"DzimDatums\": \"2000-01-31T00:00:00\",\n      \"ATVK\": \"ea nisi irure\"\n    }\n  ],\n  \"TabulaJP\": [\n    {\n      \"Valsts\": \"ipsum eu id ea\",\n      \"AdrIela\": \"nisi mollit irure Excepteur\",\n      \"AdrPilseta\": \"cillum laborum\",\n      \"AdrPasts\": \"dolor cupidata\",\n      \"IenVeids\": \"fugiat ex consequat\",\n      \"IzmDatums\": 29,\n      \"IenSumma\": 35501102.52214521,\n      \"NodLikme\": -40720481.84149244,\n      \"NodSumma\": 73375233.76676768,\n      \"JpKods\": \"mollit est Lorem aute\",\n      \"JpNosaukums\": \"fugiat consequa\",\n      \"Piezimes\": \"veniam in\",\n      \"ATVK\": \"veniam reprehenderit esse adipisicing\"\n    },\n    {\n      \"Valsts\": \"Excepteur deserunt\",\n      \"AdrIela\": \"adipisicing labore commodo cillum in\",\n      \"AdrPilseta\": \"labore non nostrud magna\",\n      \"AdrPasts\": \"ut fugiat occaecat \",\n      \"IenVeids\": \"nisi ex commodo\",\n      \"IzmDatums\": 24,\n      \"IenSumma\": -49006663.90657453,\n      \"NodLikme\": 32085369.934580848,\n      \"NodSumma\": -55044059.760223664,\n      \"JpKods\": \"culpa voluptate dolor Duis sed\",\n      \"JpNosaukums\": \"fugiat quis occaecat qui\",\n      \"Piezimes\": \"culpa velit elit\",\n      \"ATVK\": \"Lorem voluptate aliqua ut\"\n    }\n  ],\n  \"Id\": 9851816,\n  \"UID\": \"officia incididunt quis\",\n  \"Precizejums\": false,\n  \"PrecizejamaisDokuments\": -23042510,\n  \"PrecizejumaPamatojums\": \"nostrud dolor\"\n}"
    },
    {
      "name": "Lietotājs nav autentificēts.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/doc/inrv2/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "inrv2",
            ":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/inrv2/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "inrv2",
            ":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/inrv2/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "inrv2",
            ":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": ""
    }
  ]
}