Chilkat Online Tools

DataFlex / EDS API / Dokumentu saraksts.

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vQueryParams
    Handle hoQueryParams
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJarrResp
    Integer iRespStatusCode
    Variant vJson
    Handle hoJson
    Integer iId
    String sIzveidots
    String sIesniegts
    String sDokumentaVersija
    String sDokumentaVeids
    String sPeriodsNo
    String sPeriodsLidz
    String sPapildinformacija
    Integer iStatussId
    String sStatuss
    Boolean iIrBridinajumi
    Boolean iVarIesniegt
    Boolean iVarDzest
    Boolean iIrSanemtasAtbildes
    Boolean iArhivets
    Integer i
    Integer iCount_i
    String sTemp1
    Boolean bTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoQueryParams
    If (Not(IsComObjectCreated(hoQueryParams))) Begin
        Send CreateComObject of hoQueryParams
    End
    Get ComUpdateInt Of hoQueryParams "id" 25210683 To iSuccess
    Get ComUpdateString Of hoQueryParams "dokumentaVeidsKods" "nisi cillum sed" To iSuccess
    Get ComUpdateInt Of hoQueryParams "statussId" 25210683 To iSuccess
    Get ComUpdateString Of hoQueryParams "izveidotsNo" "nisi cillum sed" To iSuccess
    Get ComUpdateString Of hoQueryParams "izveidotsLidz" "nisi cillum sed" To iSuccess
    Get ComUpdateString Of hoQueryParams "iesniegtsNo" "nisi cillum sed" To iSuccess
    Get ComUpdateString Of hoQueryParams "iesniegtsLidz" "nisi cillum sed" To iSuccess
    Get ComUpdateString Of hoQueryParams "periodsNo" "nisi cillum sed" To iSuccess
    Get ComUpdateString Of hoQueryParams "periodsLidz" "nisi cillum sed" To iSuccess
    Get ComUpdateInt Of hoQueryParams "izlaistIerakstus" 25210683 To iSuccess
    Get ComUpdateInt Of hoQueryParams "atgrieztIerakstus" 25210683 To iSuccess

    Send ComSetRequestHeader To hoHttp "Accept" "application/json"

    Get pvComObject of hoQueryParams to vQueryParams
    Get ComQuickRequestParams Of hoHttp "GET" "https://eds.vid.gov.lv/api/doc" vQueryParams To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess

    Get Create (RefClass(cComChilkatJsonArray)) To hoJarrResp
    If (Not(IsComObjectCreated(hoJarrResp))) Begin
        Send CreateComObject of hoJarrResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJarrResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJarrResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJarrResp To sTemp1
    Showln sTemp1

    Get ComStatusCode Of hoResp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComHeader Of hoResp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Send Destroy of hoResp
        Procedure_Return
    End

    Send Destroy of hoResp

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

    // [
    //   {
    //     "Id": 63381534,
    //     "Izveidots": "2000-01-31T00:00:00",
    //     "Iesniegts": "2000-01-31T00:00:00",
    //     "DokumentaVersija": "ut aute enim et pariatur",
    //     "DokumentaVeids": "commodo",
    //     "PeriodsNo": "2000-01-31T00:00:00",
    //     "PeriodsLidz": "2000-01-31T00:00:00",
    //     "Papildinformacija": "in mollit Ut",
    //     "StatussId": -47605421,
    //     "Statuss": "Lorem",
    //     "IrBridinajumi": true,
    //     "VarIesniegt": true,
    //     "VarDzest": false,
    //     "IrSanemtasAtbildes": false,
    //     "Arhivets": false
    //   },
    //   {
    //     "Id": 48168202,
    //     "Izveidots": "2000-01-31T00:00:00",
    //     "Iesniegts": "2000-01-31T00:00:00",
    //     "DokumentaVersija": "est dolor in non dolore",
    //     "DokumentaVeids": "minim amet",
    //     "PeriodsNo": "2000-01-31T00:00:00",
    //     "PeriodsLidz": "2000-01-31T00:00:00",
    //     "Papildinformacija": "cillum mollit occaecat eiusmod",
    //     "StatussId": -94109410,
    //     "Statuss": "laborum incididunt consectetur",
    //     "IrBridinajumi": false,
    //     "VarIesniegt": false,
    //     "VarDzest": false,
    //     "IrSanemtasAtbildes": false,
    //     "Arhivets": true
    //   }
    // ]

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

    Move 0 To i
    Get ComSize Of hoJarrResp To iCount_i
    While (i < iCount_i)
        Get ComObjectAt Of hoJarrResp i To vJson
        If (IsComObject(vJson)) Begin
            Get Create (RefClass(cComChilkatJsonObject)) To hoJson
            Set pvComObject Of hoJson To vJson
        End
        Get ComIntOf Of hoJson "Id" To iId
        Get ComStringOf Of hoJson "Izveidots" To sIzveidots
        Get ComStringOf Of hoJson "Iesniegts" To sIesniegts
        Get ComStringOf Of hoJson "DokumentaVersija" To sDokumentaVersija
        Get ComStringOf Of hoJson "DokumentaVeids" To sDokumentaVeids
        Get ComStringOf Of hoJson "PeriodsNo" To sPeriodsNo
        Get ComStringOf Of hoJson "PeriodsLidz" To sPeriodsLidz
        Get ComStringOf Of hoJson "Papildinformacija" To sPapildinformacija
        Get ComIntOf Of hoJson "StatussId" To iStatussId
        Get ComStringOf Of hoJson "Statuss" To sStatuss
        Get ComBoolOf Of hoJson "IrBridinajumi" To iIrBridinajumi
        Get ComBoolOf Of hoJson "VarIesniegt" To iVarIesniegt
        Get ComBoolOf Of hoJson "VarDzest" To iVarDzest
        Get ComBoolOf Of hoJson "IrSanemtasAtbildes" To iIrSanemtasAtbildes
        Get ComBoolOf Of hoJson "Arhivets" To iArhivets
        Send Destroy of hoJson
        Move (i + 1) To i
    Loop



End_Procedure

Curl Command

curl -G -d "id=25210683"
	-d "dokumentaVeidsKods=nisi%20cillum%20sed"
	-d "statussId=25210683"
	-d "izveidotsNo=nisi%20cillum%20sed"
	-d "izveidotsLidz=nisi%20cillum%20sed"
	-d "iesniegtsNo=nisi%20cillum%20sed"
	-d "iesniegtsLidz=nisi%20cillum%20sed"
	-d "periodsNo=nisi%20cillum%20sed"
	-d "periodsLidz=nisi%20cillum%20sed"
	-d "izlaistIerakstus=25210683"
	-d "atgrieztIerakstus=25210683"
	-H "Accept: application/json"
https://eds.vid.gov.lv/api/doc

Postman Collection Item JSON

{
  "name": "Dokumentu saraksts.",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/doc?id=25210683&dokumentaVeidsKods=nisi cillum sed&statussId=25210683&izveidotsNo=nisi cillum sed&izveidotsLidz=nisi cillum sed&iesniegtsNo=nisi cillum sed&iesniegtsLidz=nisi cillum sed&periodsNo=nisi cillum sed&periodsLidz=nisi cillum sed&izlaistIerakstus=25210683&atgrieztIerakstus=25210683",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "doc"
      ],
      "query": [
        {
          "key": "id",
          "value": "25210683",
          "description": "Dokumenta numurs."
        },
        {
          "key": "dokumentaVeidsKods",
          "value": "nisi cillum sed",
          "description": "Dokumenta veida kods."
        },
        {
          "key": "statussId",
          "value": "25210683",
          "description": "Dokumenta statusa id."
        },
        {
          "key": "izveidotsNo",
          "value": "nisi cillum sed",
          "description": "Dokumenta izveidošanas datums (no)."
        },
        {
          "key": "izveidotsLidz",
          "value": "nisi cillum sed",
          "description": "Dokumenta izveidošanas datums (līdz)."
        },
        {
          "key": "iesniegtsNo",
          "value": "nisi cillum sed",
          "description": "Dokumenta iesniegšanas datums (no)."
        },
        {
          "key": "iesniegtsLidz",
          "value": "nisi cillum sed",
          "description": "Dokumenta iesniegšanas datums (līdz)."
        },
        {
          "key": "periodsNo",
          "value": "nisi cillum sed",
          "description": "Dokumenta perioda sākums."
        },
        {
          "key": "periodsLidz",
          "value": "nisi cillum sed",
          "description": "Dokumenta perioda beigas."
        },
        {
          "key": "izlaistIerakstus",
          "value": "25210683",
          "description": "No rezultāta izlaižamo ierakstu skaits."
        },
        {
          "key": "atgrieztIerakstus",
          "value": "25210683",
          "description": "Atgriežamo ierakstu skaits (max 100)."
        }
      ]
    }
  },
  "response": [
    {
      "name": "OK",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/doc?id=25210683&dokumentaVeidsKods=nisi cillum sed&statussId=25210683&izveidotsNo=nisi cillum sed&izveidotsLidz=nisi cillum sed&iesniegtsNo=nisi cillum sed&iesniegtsLidz=nisi cillum sed&periodsNo=nisi cillum sed&periodsLidz=nisi cillum sed&izlaistIerakstus=25210683&atgrieztIerakstus=25210683",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc"
          ],
          "query": [
            {
              "key": "id",
              "value": "25210683"
            },
            {
              "key": "dokumentaVeidsKods",
              "value": "nisi cillum sed"
            },
            {
              "key": "statussId",
              "value": "25210683"
            },
            {
              "key": "izveidotsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "izveidotsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniegtsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniegtsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "izlaistIerakstus",
              "value": "25210683"
            },
            {
              "key": "atgrieztIerakstus",
              "value": "25210683"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "[\n  {\n    \"Id\": 63381534,\n    \"Izveidots\": \"2000-01-31T00:00:00\",\n    \"Iesniegts\": \"2000-01-31T00:00:00\",\n    \"DokumentaVersija\": \"ut aute enim et pariatur\",\n    \"DokumentaVeids\": \"commodo\",\n    \"PeriodsNo\": \"2000-01-31T00:00:00\",\n    \"PeriodsLidz\": \"2000-01-31T00:00:00\",\n    \"Papildinformacija\": \"in mollit Ut\",\n    \"StatussId\": -47605421,\n    \"Statuss\": \"Lorem\",\n    \"IrBridinajumi\": true,\n    \"VarIesniegt\": true,\n    \"VarDzest\": false,\n    \"IrSanemtasAtbildes\": false,\n    \"Arhivets\": false\n  },\n  {\n    \"Id\": 48168202,\n    \"Izveidots\": \"2000-01-31T00:00:00\",\n    \"Iesniegts\": \"2000-01-31T00:00:00\",\n    \"DokumentaVersija\": \"est dolor in non dolore\",\n    \"DokumentaVeids\": \"minim amet\",\n    \"PeriodsNo\": \"2000-01-31T00:00:00\",\n    \"PeriodsLidz\": \"2000-01-31T00:00:00\",\n    \"Papildinformacija\": \"cillum mollit occaecat eiusmod\",\n    \"StatussId\": -94109410,\n    \"Statuss\": \"laborum incididunt consectetur\",\n    \"IrBridinajumi\": false,\n    \"VarIesniegt\": false,\n    \"VarDzest\": false,\n    \"IrSanemtasAtbildes\": false,\n    \"Arhivets\": true\n  }\n]"
    },
    {
      "name": "Lietotājs nav autentificēts.",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/doc?id=25210683&dokumentaVeidsKods=nisi cillum sed&statussId=25210683&izveidotsNo=nisi cillum sed&izveidotsLidz=nisi cillum sed&iesniegtsNo=nisi cillum sed&iesniegtsLidz=nisi cillum sed&periodsNo=nisi cillum sed&periodsLidz=nisi cillum sed&izlaistIerakstus=25210683&atgrieztIerakstus=25210683",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc"
          ],
          "query": [
            {
              "key": "id",
              "value": "25210683"
            },
            {
              "key": "dokumentaVeidsKods",
              "value": "nisi cillum sed"
            },
            {
              "key": "statussId",
              "value": "25210683"
            },
            {
              "key": "izveidotsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "izveidotsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniegtsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniegtsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "izlaistIerakstus",
              "value": "25210683"
            },
            {
              "key": "atgrieztIerakstus",
              "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/doc?id=25210683&dokumentaVeidsKods=nisi cillum sed&statussId=25210683&izveidotsNo=nisi cillum sed&izveidotsLidz=nisi cillum sed&iesniegtsNo=nisi cillum sed&iesniegtsLidz=nisi cillum sed&periodsNo=nisi cillum sed&periodsLidz=nisi cillum sed&izlaistIerakstus=25210683&atgrieztIerakstus=25210683",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc"
          ],
          "query": [
            {
              "key": "id",
              "value": "25210683"
            },
            {
              "key": "dokumentaVeidsKods",
              "value": "nisi cillum sed"
            },
            {
              "key": "statussId",
              "value": "25210683"
            },
            {
              "key": "izveidotsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "izveidotsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniegtsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniegtsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "izlaistIerakstus",
              "value": "25210683"
            },
            {
              "key": "atgrieztIerakstus",
              "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/doc?id=25210683&dokumentaVeidsKods=nisi cillum sed&statussId=25210683&izveidotsNo=nisi cillum sed&izveidotsLidz=nisi cillum sed&iesniegtsNo=nisi cillum sed&iesniegtsLidz=nisi cillum sed&periodsNo=nisi cillum sed&periodsLidz=nisi cillum sed&izlaistIerakstus=25210683&atgrieztIerakstus=25210683",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "doc"
          ],
          "query": [
            {
              "key": "id",
              "value": "25210683"
            },
            {
              "key": "dokumentaVeidsKods",
              "value": "nisi cillum sed"
            },
            {
              "key": "statussId",
              "value": "25210683"
            },
            {
              "key": "izveidotsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "izveidotsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniegtsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "iesniegtsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsNo",
              "value": "nisi cillum sed"
            },
            {
              "key": "periodsLidz",
              "value": "nisi cillum sed"
            },
            {
              "key": "izlaistIerakstus",
              "value": "25210683"
            },
            {
              "key": "atgrieztIerakstus",
              "value": "25210683"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}