Chilkat Online Tools

C / EDS API / Izveidot dokumentu "Informācija par izmaksātajām mācību maksas kompensācijām".

Back to Collection Items

#include <C_CkHttp.h>
#include <C_CkHttpRequest.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>
#include <C_CkStringBuilder.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkHttpRequest req;
    HCkJsonObject jsonParam5;
    HCkJsonObject jsonParam6;
    HCkHttpResponse resp;
    HCkStringBuilder sbResponseBody;
    HCkJsonObject jResp;
    int respStatusCode;

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

    http = CkHttp_Create();

    req = CkHttpRequest_Create();
    CkHttpRequest_AddParam(req,"Epasts","culpa est eu");
    CkHttpRequest_AddParam(req,"Talrunis","ipsum ei");
    CkHttpRequest_AddParam(req,"Sagatavotajs","id labore");
    CkHttpRequest_AddParam(req,"TaksGads","-69406522");

    jsonParam5 = CkJsonObject_Create();
    CkJsonObject_UpdateString(jsonParam5,"PersonasKods","i");
    CkJsonObject_UpdateString(jsonParam5,"VardsUzvards","incididunt veniam amet dolor sunt");
    CkJsonObject_UpdateNumber(jsonParam5,"IzmaksataSumma","12131622.977891028");
    CkJsonObject_UpdateString(jsonParam5,"IzmaksasDatums","2000-01-31T00:00:00");
    CkJsonObject_UpdateString(jsonParam5,"KalendaraGads","aliquip esse");
    CkHttpRequest_AddParam(req,"Tabula",CkJsonObject_emit(jsonParam5));

    jsonParam6 = CkJsonObject_Create();
    CkJsonObject_UpdateString(jsonParam6,"PersonasKods","veni");
    CkJsonObject_UpdateString(jsonParam6,"VardsUzvards","ea occaecat");
    CkJsonObject_UpdateNumber(jsonParam6,"IzmaksataSumma","62345567.95502934");
    CkJsonObject_UpdateString(jsonParam6,"IzmaksasDatums","2000-01-31T00:00:00");
    CkJsonObject_UpdateString(jsonParam6,"KalendaraGads","non nulla Lorem tempor ea");
    CkHttpRequest_AddParam(req,"Tabula",CkJsonObject_emit(jsonParam6));
    CkHttpRequest_AddParam(req,"NmrKods","sunt e");
    CkHttpRequest_AddParam(req,"Precizejums","true");
    CkHttpRequest_AddParam(req,"PrecizejamaisDokuments","96224726");
    CkHttpRequest_AddParam(req,"PrecizejumaPamatojums","ullamco");

    CkHttpRequest_AddHeader(req,"Accept","application/json");

    resp = CkHttp_PostUrlEncoded(http,"https://eds.vid.gov.lv/api/doc/mmkv1",req);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkHttpRequest_Dispose(req);
        CkJsonObject_Dispose(jsonParam5);
        CkJsonObject_Dispose(jsonParam6);
        return;
    }

    sbResponseBody = CkStringBuilder_Create();
    CkHttpResponse_GetBodySb(resp,sbResponseBody);

    jResp = CkJsonObject_Create();
    CkJsonObject_LoadSb(jResp,sbResponseBody);
    CkJsonObject_putEmitCompact(jResp,FALSE);

    printf("Response Body:\n");
    printf("%s\n",CkJsonObject_emit(jResp));

    respStatusCode = CkHttpResponse_getStatusCode(resp);
    printf("Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        printf("Response Header:\n");
        printf("%s\n",CkHttpResponse_header(resp));
        printf("Failed.\n");
        CkHttpResponse_Dispose(resp);
        CkHttp_Dispose(http);
        CkHttpRequest_Dispose(req);
        CkJsonObject_Dispose(jsonParam5);
        CkJsonObject_Dispose(jsonParam6);
        CkStringBuilder_Dispose(sbResponseBody);
        CkJsonObject_Dispose(jResp);
        return;
    }

    CkHttpResponse_Dispose(resp);


    CkHttp_Dispose(http);
    CkHttpRequest_Dispose(req);
    CkJsonObject_Dispose(jsonParam5);
    CkJsonObject_Dispose(jsonParam6);
    CkStringBuilder_Dispose(sbResponseBody);
    CkJsonObject_Dispose(jResp);

    }

Curl Command

curl -X POST
	-H "Content-Type: application/x-www-form-urlencoded"
	-H "Accept: application/json"
	--data-urlencode 'Epasts=culpa est eu'
	--data-urlencode 'Talrunis=ipsum ei'
	--data-urlencode 'Sagatavotajs=id labore'
	--data-urlencode 'TaksGads=-69406522'
	--data-urlencode 'Tabula={"PersonasKods":"i","VardsUzvards":"incididunt veniam amet dolor sunt","IzmaksataSumma":12131622.977891028,"IzmaksasDatums":"2000-01-31T00:00:00","KalendaraGads":"aliquip esse"}'
	--data-urlencode 'Tabula={"PersonasKods":"veni","VardsUzvards":"ea occaecat","IzmaksataSumma":62345567.95502934,"IzmaksasDatums":"2000-01-31T00:00:00","KalendaraGads":"non nulla Lorem tempor ea"}'
	--data-urlencode 'NmrKods=sunt e'
	--data-urlencode 'Precizejums=true'
	--data-urlencode 'PrecizejamaisDokuments=96224726'
	--data-urlencode 'PrecizejumaPamatojums=ullamco'
https://eds.vid.gov.lv/api/doc/mmkv1

Postman Collection Item JSON

{
  "name": "Izveidot dokumentu \"Informācija par izmaksātajām mācību maksas kompensācijām\".",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "application/x-www-form-urlencoded"
      },
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "urlencoded",
      "urlencoded": [
        {
          "key": "Epasts",
          "value": "culpa est eu",
          "description": "(Required) Epasta adrese."
        },
        {
          "key": "Talrunis",
          "value": "ipsum ei",
          "description": "(Required) Iesniedzēja tālrunis."
        },
        {
          "key": "Sagatavotajs",
          "value": "id labore",
          "description": "(Required) Sagatavotāja vārds, uzvārds."
        },
        {
          "key": "TaksGads",
          "value": "-69406522",
          "description": "(Required) Taksācijas gads."
        },
        {
          "key": "Tabula",
          "value": "{\"PersonasKods\":\"i\",\"VardsUzvards\":\"incididunt veniam amet dolor sunt\",\"IzmaksataSumma\":12131622.977891028,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"aliquip esse\"}",
          "description": "Tabula."
        },
        {
          "key": "Tabula",
          "value": "{\"PersonasKods\":\"veni\",\"VardsUzvards\":\"ea occaecat\",\"IzmaksataSumma\":62345567.95502934,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"non nulla Lorem tempor ea\"}",
          "description": "Tabula."
        },
        {
          "key": "NmrKods",
          "value": "sunt e",
          "description": "Nodokļu maksātāja kods."
        },
        {
          "key": "Precizejums",
          "value": "true",
          "description": "Vai dokuments ir precizējums."
        },
        {
          "key": "PrecizejamaisDokuments",
          "value": "96224726",
          "description": "Precizējamā dokumenta numurs."
        },
        {
          "key": "PrecizejumaPamatojums",
          "value": "ullamco",
          "description": "Precizējuma pamatojums."
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/api/doc/mmkv1",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "doc",
        "mmkv1"
      ]
    }
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "Epasts",
              "value": "fugiat eu mollit",
              "description": "(Required) Epasta adrese."
            },
            {
              "key": "Talrunis",
              "value": "elit",
              "description": "(Required) Iesniedzēja tālrunis."
            },
            {
              "key": "Sagatavotajs",
              "value": "mollit tempor labore laboris ullamco",
              "description": "(Required) Sagatavotāja vārds, uzvārds."
            },
            {
              "key": "TaksGads",
              "value": "47093049",
              "description": "(Required) Taksācijas gads."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"aliquip\",\"VardsUzvards\":\"voluptate\",\"IzmaksataSumma\":-12139701.987933502,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"mollit commodo occaecat\"}",
              "description": "Tabula."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"id aliqu\",\"VardsUzvards\":\"fugiat est in dolor\",\"IzmaksataSumma\":-87261623.4254953,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"dolor minim\"}",
              "description": "Tabula."
            },
            {
              "key": "NmrKods",
              "value": "consequat ",
              "description": "Nodokļu maksātāja kods."
            },
            {
              "key": "Precizejums",
              "value": "true",
              "description": "Vai dokuments ir precizējums."
            },
            {
              "key": "PrecizejamaisDokuments",
              "value": "19626243",
              "description": "Precizējamā dokumenta numurs."
            },
            {
              "key": "PrecizejumaPamatojums",
              "value": "qui mollit",
              "description": "Precizējuma pamatojums."
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/api/doc/mmkv1",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "mmkv1"
          ]
        }
      },
      "status": "Created",
      "code": 201,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "-12855709"
    },
    {
      "name": "Pieprasījuma dati ir kļūdaini.",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "Epasts",
              "value": "fugiat eu mollit",
              "description": "(Required) Epasta adrese."
            },
            {
              "key": "Talrunis",
              "value": "elit",
              "description": "(Required) Iesniedzēja tālrunis."
            },
            {
              "key": "Sagatavotajs",
              "value": "mollit tempor labore laboris ullamco",
              "description": "(Required) Sagatavotāja vārds, uzvārds."
            },
            {
              "key": "TaksGads",
              "value": "47093049",
              "description": "(Required) Taksācijas gads."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"aliquip\",\"VardsUzvards\":\"voluptate\",\"IzmaksataSumma\":-12139701.987933502,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"mollit commodo occaecat\"}",
              "description": "Tabula."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"id aliqu\",\"VardsUzvards\":\"fugiat est in dolor\",\"IzmaksataSumma\":-87261623.4254953,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"dolor minim\"}",
              "description": "Tabula."
            },
            {
              "key": "NmrKods",
              "value": "consequat ",
              "description": "Nodokļu maksātāja kods."
            },
            {
              "key": "Precizejums",
              "value": "true",
              "description": "Vai dokuments ir precizējums."
            },
            {
              "key": "PrecizejamaisDokuments",
              "value": "19626243",
              "description": "Precizējamā dokumenta numurs."
            },
            {
              "key": "PrecizejumaPamatojums",
              "value": "qui mollit",
              "description": "Precizējuma pamatojums."
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/api/doc/mmkv1",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "mmkv1"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Lietotājs nav autentificēts.",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "Epasts",
              "value": "fugiat eu mollit",
              "description": "(Required) Epasta adrese."
            },
            {
              "key": "Talrunis",
              "value": "elit",
              "description": "(Required) Iesniedzēja tālrunis."
            },
            {
              "key": "Sagatavotajs",
              "value": "mollit tempor labore laboris ullamco",
              "description": "(Required) Sagatavotāja vārds, uzvārds."
            },
            {
              "key": "TaksGads",
              "value": "47093049",
              "description": "(Required) Taksācijas gads."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"aliquip\",\"VardsUzvards\":\"voluptate\",\"IzmaksataSumma\":-12139701.987933502,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"mollit commodo occaecat\"}",
              "description": "Tabula."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"id aliqu\",\"VardsUzvards\":\"fugiat est in dolor\",\"IzmaksataSumma\":-87261623.4254953,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"dolor minim\"}",
              "description": "Tabula."
            },
            {
              "key": "NmrKods",
              "value": "consequat ",
              "description": "Nodokļu maksātāja kods."
            },
            {
              "key": "Precizejums",
              "value": "true",
              "description": "Vai dokuments ir precizējums."
            },
            {
              "key": "PrecizejamaisDokuments",
              "value": "19626243",
              "description": "Precizējamā dokumenta numurs."
            },
            {
              "key": "PrecizejumaPamatojums",
              "value": "qui mollit",
              "description": "Precizējuma pamatojums."
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/api/doc/mmkv1",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "mmkv1"
          ]
        }
      },
      "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": "POST",
        "header": [
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "Epasts",
              "value": "fugiat eu mollit",
              "description": "(Required) Epasta adrese."
            },
            {
              "key": "Talrunis",
              "value": "elit",
              "description": "(Required) Iesniedzēja tālrunis."
            },
            {
              "key": "Sagatavotajs",
              "value": "mollit tempor labore laboris ullamco",
              "description": "(Required) Sagatavotāja vārds, uzvārds."
            },
            {
              "key": "TaksGads",
              "value": "47093049",
              "description": "(Required) Taksācijas gads."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"aliquip\",\"VardsUzvards\":\"voluptate\",\"IzmaksataSumma\":-12139701.987933502,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"mollit commodo occaecat\"}",
              "description": "Tabula."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"id aliqu\",\"VardsUzvards\":\"fugiat est in dolor\",\"IzmaksataSumma\":-87261623.4254953,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"dolor minim\"}",
              "description": "Tabula."
            },
            {
              "key": "NmrKods",
              "value": "consequat ",
              "description": "Nodokļu maksātāja kods."
            },
            {
              "key": "Precizejums",
              "value": "true",
              "description": "Vai dokuments ir precizējums."
            },
            {
              "key": "PrecizejamaisDokuments",
              "value": "19626243",
              "description": "Precizējamā dokumenta numurs."
            },
            {
              "key": "PrecizejumaPamatojums",
              "value": "qui mollit",
              "description": "Precizējuma pamatojums."
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/api/doc/mmkv1",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "mmkv1"
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Dokumenta unikalitātes ierobežojums. Dokuments par norādīto periodu jau izveidots. Lai izveidotu atkārtoti, izmantojiet jaunu drošības talonu.",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "Epasts",
              "value": "fugiat eu mollit",
              "description": "(Required) Epasta adrese."
            },
            {
              "key": "Talrunis",
              "value": "elit",
              "description": "(Required) Iesniedzēja tālrunis."
            },
            {
              "key": "Sagatavotajs",
              "value": "mollit tempor labore laboris ullamco",
              "description": "(Required) Sagatavotāja vārds, uzvārds."
            },
            {
              "key": "TaksGads",
              "value": "47093049",
              "description": "(Required) Taksācijas gads."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"aliquip\",\"VardsUzvards\":\"voluptate\",\"IzmaksataSumma\":-12139701.987933502,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"mollit commodo occaecat\"}",
              "description": "Tabula."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"id aliqu\",\"VardsUzvards\":\"fugiat est in dolor\",\"IzmaksataSumma\":-87261623.4254953,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"dolor minim\"}",
              "description": "Tabula."
            },
            {
              "key": "NmrKods",
              "value": "consequat ",
              "description": "Nodokļu maksātāja kods."
            },
            {
              "key": "Precizejums",
              "value": "true",
              "description": "Vai dokuments ir precizējums."
            },
            {
              "key": "PrecizejamaisDokuments",
              "value": "19626243",
              "description": "Precizējamā dokumenta numurs."
            },
            {
              "key": "PrecizejumaPamatojums",
              "value": "qui mollit",
              "description": "Precizējuma pamatojums."
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/api/doc/mmkv1",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "mmkv1"
          ]
        }
      },
      "status": "Conflict",
      "code": 409,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Pārsniegts izsaukumu skaita ierobežojums.",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "Epasts",
              "value": "fugiat eu mollit",
              "description": "(Required) Epasta adrese."
            },
            {
              "key": "Talrunis",
              "value": "elit",
              "description": "(Required) Iesniedzēja tālrunis."
            },
            {
              "key": "Sagatavotajs",
              "value": "mollit tempor labore laboris ullamco",
              "description": "(Required) Sagatavotāja vārds, uzvārds."
            },
            {
              "key": "TaksGads",
              "value": "47093049",
              "description": "(Required) Taksācijas gads."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"aliquip\",\"VardsUzvards\":\"voluptate\",\"IzmaksataSumma\":-12139701.987933502,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"mollit commodo occaecat\"}",
              "description": "Tabula."
            },
            {
              "key": "Tabula",
              "value": "{\"PersonasKods\":\"id aliqu\",\"VardsUzvards\":\"fugiat est in dolor\",\"IzmaksataSumma\":-87261623.4254953,\"IzmaksasDatums\":\"2000-01-31T00:00:00\",\"KalendaraGads\":\"dolor minim\"}",
              "description": "Tabula."
            },
            {
              "key": "NmrKods",
              "value": "consequat ",
              "description": "Nodokļu maksātāja kods."
            },
            {
              "key": "Precizejums",
              "value": "true",
              "description": "Vai dokuments ir precizējums."
            },
            {
              "key": "PrecizejamaisDokuments",
              "value": "19626243",
              "description": "Precizējamā dokumenta numurs."
            },
            {
              "key": "PrecizejumaPamatojums",
              "value": "qui mollit",
              "description": "Precizējuma pamatojums."
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/api/doc/mmkv1",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc",
            "mmkv1"
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}