Chilkat Online Tools

PowerBuilder / EDS API / Nodokļu maksātājam iesniegto algas nodokļu grāmatiņu dati.

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_PersonasKods
string ls_VardsUzvards
string ls_Numurs
string ls_IzdosanasDatums
string ls_DatumsNo
string ls_IzmainuDatums
string ls_DatumsLidz
integer j
integer li_Count_j
string ls_Value
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
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_QueryParams = create oleobject
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_QueryParams.UpdateString("tikaiIzmainas","true")
loo_QueryParams.UpdateString("periodsNo","nisi cillum sed")
loo_QueryParams.UpdateString("periodsLidz","nisi cillum sed")
loo_QueryParams.UpdateString("iesniedzejs","est i")
loo_QueryParams.UpdateInt("pmnmIzmainas",25210683)
loo_QueryParams.UpdateInt("neattelotAtvieglojumus",25210683)

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

loo_Resp = loo_Http.QuickRequestParams("GET","https://eds.vid.gov.lv/api/reports/taxbooks",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_QueryParams
    return
end if

loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

loo_Resp.GetBodySb(loo_SbResponseBody)

loo_JResp = create oleobject
li_rc = loo_JResp.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

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

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

destroy loo_Resp

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

// {
//   "Gramatinas": [
//     {
//       "PersonasKods": "incididunt aute laborum sed",
//       "VardsUzvards": "reprehenderi",
//       "Numurs": "eiusmod sed ut tempor nulla",
//       "IzdosanasDatums": "2000-01-31T00:00:00",
//       "DatumsNo": "2000-01-31T00:00:00",
//       "IzmainuDatums": "2000-01-31T00:00:00",
//       "DatumsLidz": "2000-01-31T00:00:00",
//       "Apgadajamie": [
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         },
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         }
//       ],
//       "Pensijas": [
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         },
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         }
//       ],
//       "PapilduAtvieglojumi": [
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         },
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         }
//       ],
//       "IinLikmes": [
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         },
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         }
//       ],
//       "PrognozetaisMinimums": [
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         },
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         }
//       ]
//     },
//     {
//       "PersonasKods": "qui cillum fugiat",
//       "VardsUzvards": "reprehenderit minim consectetur consequat ea",
//       "Numurs": "ut labore mollit",
//       "IzdosanasDatums": "2000-01-31T00:00:00",
//       "DatumsNo": "2000-01-31T00:00:00",
//       "IzmainuDatums": "2000-01-31T00:00:00",
//       "DatumsLidz": "2000-01-31T00:00:00",
//       "Apgadajamie": [
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         },
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         }
//       ],
//       "Pensijas": [
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         },
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         }
//       ],
//       "PapilduAtvieglojumi": [
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         },
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         }
//       ],
//       "IinLikmes": [
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         },
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         }
//       ],
//       "PrognozetaisMinimums": [
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         },
//         {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         }
//       ]
//     }
//   ]
// }

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

i = 0
li_Count_i = loo_JResp.SizeOfArray("Gramatinas")
do while i < li_Count_i
    loo_JResp.I = i
    ls_PersonasKods = loo_JResp.StringOf("Gramatinas[i].PersonasKods")
    ls_VardsUzvards = loo_JResp.StringOf("Gramatinas[i].VardsUzvards")
    ls_Numurs = loo_JResp.StringOf("Gramatinas[i].Numurs")
    ls_IzdosanasDatums = loo_JResp.StringOf("Gramatinas[i].IzdosanasDatums")
    ls_DatumsNo = loo_JResp.StringOf("Gramatinas[i].DatumsNo")
    ls_IzmainuDatums = loo_JResp.StringOf("Gramatinas[i].IzmainuDatums")
    ls_DatumsLidz = loo_JResp.StringOf("Gramatinas[i].DatumsLidz")
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("Gramatinas[i].Apgadajamie")
    do while j < li_Count_j
        loo_JResp.J = j
        ls_Value = loo_JResp.StringOf("Gramatinas[i].Apgadajamie[j].value")
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("Gramatinas[i].Pensijas")
    do while j < li_Count_j
        loo_JResp.J = j
        ls_Value = loo_JResp.StringOf("Gramatinas[i].Pensijas[j].value")
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("Gramatinas[i].PapilduAtvieglojumi")
    do while j < li_Count_j
        loo_JResp.J = j
        ls_Value = loo_JResp.StringOf("Gramatinas[i].PapilduAtvieglojumi[j].value")
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("Gramatinas[i].IinLikmes")
    do while j < li_Count_j
        loo_JResp.J = j
        ls_Value = loo_JResp.StringOf("Gramatinas[i].IinLikmes[j].value")
        j = j + 1
    loop
    j = 0
    li_Count_j = loo_JResp.SizeOfArray("Gramatinas[i].PrognozetaisMinimums")
    do while j < li_Count_j
        loo_JResp.J = j
        ls_Value = loo_JResp.StringOf("Gramatinas[i].PrognozetaisMinimums[j].value")
        j = j + 1
    loop
    i = i + 1
loop


destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl -G -d "tikaiIzmainas=true"
	-d "periodsNo=nisi%20cillum%20sed"
	-d "periodsLidz=nisi%20cillum%20sed"
	-d "iesniedzejs=est%20i"
	-d "pmnmIzmainas=25210683"
	-d "neattelotAtvieglojumus=25210683"
	-H "Accept: application/json"
https://eds.vid.gov.lv/api/reports/taxbooks

Postman Collection Item JSON

{
  "name": "Nodokļu maksātājam iesniegto algas nodokļu grāmatiņu dati.",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/reports/taxbooks?tikaiIzmainas=true&periodsNo=nisi cillum sed&periodsLidz=nisi cillum sed&iesniedzejs=est i&pmnmIzmainas=25210683&neattelotAtvieglojumus=25210683",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "reports",
        "taxbooks"
      ],
      "query": [
        {
          "key": "tikaiIzmainas",
          "value": "true",
          "description": "Atlasīt tikai tās grāmatiņas kurās veiktas izmaiņas."
        },
        {
          "key": "periodsNo",
          "value": "nisi cillum sed",
          "description": "(Required) Pārskata perioda sākuma datums."
        },
        {
          "key": "periodsLidz",
          "value": "nisi cillum sed",
          "description": "ārskata perioda beigu datums."
        },
        {
          "key": "iesniedzejs",
          "value": "est i",
          "description": "Grāmatiņas iesniedzēja personas kods."
        },
        {
          "key": "pmnmIzmainas",
          "value": "25210683",
          "description": "Iekļaut nodokļu maksātājus, kuriem:\r\n0 - mainījušies algas nodokļa grāmatiņas dati, izņemot prognozēto mēneša neapliekamo minimumu;\r\n1 - mainījušies algas nodokļa grāmatiņas dati, tai skaitā arī prognozētais mēneša neapliekamais minimums;\r\n2 - mainījies tikai prognozētais mēneša neapliekamais minimums."
        },
        {
          "key": "neattelotAtvieglojumus",
          "value": "25210683",
          "description": "Neattēlot nodokļa atvieglojumus, kuri bija spēkā pirms pārskatā norādītā perioda."
        }
      ]
    }
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/reports/taxbooks?tikaiIzmainas=true&periodsNo=nisi cillum sed&periodsLidz=nisi cillum sed&iesniedzejs=est i&pmnmIzmainas=25210683&neattelotAtvieglojumus=25210683",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "reports",
            "taxbooks"
          ],
          "query": [
            {
              "key": "tikaiIzmainas",
              "value": "true"
            },
            {
              "key": "periodsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniedzejs",
              "value": "est i"
            },
            {
              "key": "pmnmIzmainas",
              "value": "25210683"
            },
            {
              "key": "neattelotAtvieglojumus",
              "value": "25210683"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"Gramatinas\": [\n    {\n      \"PersonasKods\": \"incididunt aute laborum sed\",\n      \"VardsUzvards\": \"reprehenderi\",\n      \"Numurs\": \"eiusmod sed ut tempor nulla\",\n      \"IzdosanasDatums\": \"2000-01-31T00:00:00\",\n      \"DatumsNo\": \"2000-01-31T00:00:00\",\n      \"IzmainuDatums\": \"2000-01-31T00:00:00\",\n      \"DatumsLidz\": \"2000-01-31T00:00:00\",\n      \"Apgadajamie\": [\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        },\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        }\n      ],\n      \"Pensijas\": [\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        },\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        }\n      ],\n      \"PapilduAtvieglojumi\": [\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        },\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        }\n      ],\n      \"IinLikmes\": [\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        },\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        }\n      ],\n      \"PrognozetaisMinimums\": [\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        },\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        }\n      ]\n    },\n    {\n      \"PersonasKods\": \"qui cillum fugiat\",\n      \"VardsUzvards\": \"reprehenderit minim consectetur consequat ea\",\n      \"Numurs\": \"ut labore mollit\",\n      \"IzdosanasDatums\": \"2000-01-31T00:00:00\",\n      \"DatumsNo\": \"2000-01-31T00:00:00\",\n      \"IzmainuDatums\": \"2000-01-31T00:00:00\",\n      \"DatumsLidz\": \"2000-01-31T00:00:00\",\n      \"Apgadajamie\": [\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        },\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        }\n      ],\n      \"Pensijas\": [\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        },\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        }\n      ],\n      \"PapilduAtvieglojumi\": [\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        },\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        }\n      ],\n      \"IinLikmes\": [\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        },\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        }\n      ],\n      \"PrognozetaisMinimums\": [\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        },\n        {\n          \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n        }\n      ]\n    }\n  ]\n}"
    },
    {
      "name": "Lietotājs nav autentificēts.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/reports/taxbooks?tikaiIzmainas=true&periodsNo=nisi cillum sed&periodsLidz=nisi cillum sed&iesniedzejs=est i&pmnmIzmainas=25210683&neattelotAtvieglojumus=25210683",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "reports",
            "taxbooks"
          ],
          "query": [
            {
              "key": "tikaiIzmainas",
              "value": "true"
            },
            {
              "key": "periodsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniedzejs",
              "value": "est i"
            },
            {
              "key": "pmnmIzmainas",
              "value": "25210683"
            },
            {
              "key": "neattelotAtvieglojumus",
              "value": "25210683"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Lietotājam nav tiesību veikt šo darbību.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/reports/taxbooks?tikaiIzmainas=true&periodsNo=nisi cillum sed&periodsLidz=nisi cillum sed&iesniedzejs=est i&pmnmIzmainas=25210683&neattelotAtvieglojumus=25210683",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "reports",
            "taxbooks"
          ],
          "query": [
            {
              "key": "tikaiIzmainas",
              "value": "true"
            },
            {
              "key": "periodsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniedzejs",
              "value": "est i"
            },
            {
              "key": "pmnmIzmainas",
              "value": "25210683"
            },
            {
              "key": "neattelotAtvieglojumus",
              "value": "25210683"
            }
          ]
        }
      },
      "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/reports/taxbooks?tikaiIzmainas=true&periodsNo=nisi cillum sed&periodsLidz=nisi cillum sed&iesniedzejs=est i&pmnmIzmainas=25210683&neattelotAtvieglojumus=25210683",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "reports",
            "taxbooks"
          ],
          "query": [
            {
              "key": "tikaiIzmainas",
              "value": "true"
            },
            {
              "key": "periodsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniedzejs",
              "value": "est i"
            },
            {
              "key": "pmnmIzmainas",
              "value": "25210683"
            },
            {
              "key": "neattelotAtvieglojumus",
              "value": "25210683"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}