phpExt / EDS API / Nodokļu maksātājam iesniegto algas nodokļu grāmatiņu dati.
Back to Collection Items
<?php
include("chilkat.php");
// Use "chilkat_9_5_0.php" for versions of Chilkat < 10.0.0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
$http = new CkHttp();
$queryParams = new CkJsonObject();
$queryParams->UpdateString('tikaiIzmainas','true');
$queryParams->UpdateString('periodsNo','nisi cillum sed');
$queryParams->UpdateString('periodsLidz','nisi cillum sed');
$queryParams->UpdateString('iesniedzejs','est i');
$queryParams->UpdateInt('pmnmIzmainas',25210683);
$queryParams->UpdateInt('neattelotAtvieglojumus',25210683);
$http->SetRequestHeader('Accept','application/json');
// resp is a CkHttpResponse
$resp = $http->QuickRequestParams('GET','https://eds.vid.gov.lv/api/reports/taxbooks',$queryParams);
if ($http->get_LastMethodSuccess() == false) {
print $http->lastErrorText() . "\n";
exit;
}
$sbResponseBody = new CkStringBuilder();
$resp->GetBodySb($sbResponseBody);
$jResp = new CkJsonObject();
$jResp->LoadSb($sbResponseBody);
$jResp->put_EmitCompact(false);
print 'Response Body:' . "\n";
print $jResp->emit() . "\n";
$respStatusCode = $resp->get_StatusCode();
print 'Response Status Code = ' . $respStatusCode . "\n";
if ($respStatusCode >= 400) {
print 'Response Header:' . "\n";
print $resp->header() . "\n";
print 'Failed.' . "\n";
exit;
}
// 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;
$count_i = $jResp->SizeOfArray('Gramatinas');
while ($i < $count_i) {
$jResp->put_I($i);
$PersonasKods = $jResp->stringOf('Gramatinas[i].PersonasKods');
$VardsUzvards = $jResp->stringOf('Gramatinas[i].VardsUzvards');
$Numurs = $jResp->stringOf('Gramatinas[i].Numurs');
$IzdosanasDatums = $jResp->stringOf('Gramatinas[i].IzdosanasDatums');
$DatumsNo = $jResp->stringOf('Gramatinas[i].DatumsNo');
$IzmainuDatums = $jResp->stringOf('Gramatinas[i].IzmainuDatums');
$DatumsLidz = $jResp->stringOf('Gramatinas[i].DatumsLidz');
$j = 0;
$count_j = $jResp->SizeOfArray('Gramatinas[i].Apgadajamie');
while ($j < $count_j) {
$jResp->put_J($j);
$value = $jResp->stringOf('Gramatinas[i].Apgadajamie[j].value');
$j = $j + 1;
}
$j = 0;
$count_j = $jResp->SizeOfArray('Gramatinas[i].Pensijas');
while ($j < $count_j) {
$jResp->put_J($j);
$value = $jResp->stringOf('Gramatinas[i].Pensijas[j].value');
$j = $j + 1;
}
$j = 0;
$count_j = $jResp->SizeOfArray('Gramatinas[i].PapilduAtvieglojumi');
while ($j < $count_j) {
$jResp->put_J($j);
$value = $jResp->stringOf('Gramatinas[i].PapilduAtvieglojumi[j].value');
$j = $j + 1;
}
$j = 0;
$count_j = $jResp->SizeOfArray('Gramatinas[i].IinLikmes');
while ($j < $count_j) {
$jResp->put_J($j);
$value = $jResp->stringOf('Gramatinas[i].IinLikmes[j].value');
$j = $j + 1;
}
$j = 0;
$count_j = $jResp->SizeOfArray('Gramatinas[i].PrognozetaisMinimums');
while ($j < $count_j) {
$jResp->put_J($j);
$value = $jResp->stringOf('Gramatinas[i].PrognozetaisMinimums[j].value');
$j = $j + 1;
}
$i = $i + 1;
}
?>
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": ""
}
]
}