C / EDS API / Iesniegt dokumentu.
Back to Collection Items
#include <C_CkHttp.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>
void ChilkatSample(void)
{
HCkHttp http;
BOOL success;
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();
CkHttp_SetRequestHeader(http,"Accept","application/json");
sbResponseBody = CkStringBuilder_Create();
success = CkHttp_QuickGetSb(http,"https://eds.vid.gov.lv/api/doc/:id/submit",sbResponseBody);
if (success == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);
return;
}
jResp = CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
CkJsonObject_putEmitCompact(jResp,FALSE);
printf("Response Body:\n");
printf("%s\n",CkJsonObject_emit(jResp));
respStatusCode = CkHttp_getLastStatus(http);
printf("Response Status Code = %d\n",respStatusCode);
if (respStatusCode >= 400) {
printf("Response Header:\n");
printf("%s\n",CkHttp_lastHeader(http));
printf("Failed.\n");
CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
return;
}
CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
}
Curl Command
curl -X GET
-H "Accept: application/json"
https://eds.vid.gov.lv/api/doc/:id/submit
Postman Collection Item JSON
{
"name": "Iesniegt dokumentu.",
"request": {
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/doc/:id/submit",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"doc",
":id",
"submit"
],
"variable": [
{
"key": "id",
"value": "25210683",
"description": "(Required) Dokumenta numurs."
}
]
}
},
"response": [
{
"name": "Uzsākts dokumenta iesniegšanas process.",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/api/doc/:id/submit",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"doc",
":id",
"submit"
],
"variable": [
{
"key": "id",
"value": "25210683",
"description": "(Required) Dokumenta numurs."
}
]
}
},
"status": "Accepted",
"code": 202,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{}"
},
{
"name": "Lietotājs nav autentificēts.",
"originalRequest": {
"method": "GET",
"header": [
],
"url": {
"raw": "{{baseUrl}}/api/doc/:id/submit",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"doc",
":id",
"submit"
],
"variable": [
{
"key": "id",
"value": "25210683",
"description": "(Required) Dokumenta numurs."
}
]
}
},
"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/:id/submit",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"doc",
":id",
"submit"
],
"variable": [
{
"key": "id",
"value": "25210683",
"description": "(Required) Dokumenta numurs."
}
]
}
},
"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/:id/submit",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"doc",
":id",
"submit"
],
"variable": [
{
"key": "id",
"value": "25210683",
"description": "(Required) Dokumenta numurs."
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}