Chilkat Online Tools

Powershell / EDS API / Autorizācijas talona atcelšana.

Back to Collection Items

Add-Type -Path "C:\chilkat\ChilkatDotNet47-9.5.0-x64\ChilkatDotNet47.dll"

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

$http = New-Object Chilkat.Http

$http.SetRequestHeader("Accept","application/json")

$resp = $http.QuickRequest("DELETE","https://eds.vid.gov.lv/api/auth")
if ($http.LastMethodSuccess -eq $false) {
    $($http.LastErrorText)
    exit
}

$sbResponseBody = New-Object Chilkat.StringBuilder
$resp.GetBodySb($sbResponseBody)

$jResp = New-Object Chilkat.JsonObject
$jResp.LoadSb($sbResponseBody)
$jResp.EmitCompact = $false

$("Response Body:")
$($jResp.Emit())

$respStatusCode = $resp.StatusCode
$("Response Status Code = " + $respStatusCode)
if ($respStatusCode -ge 400) {
    $("Response Header:")
    $($resp.Header)
    $("Failed.")

    exit
}

Curl Command

curl -X DELETE
	-H "Accept: application/json"
https://eds.vid.gov.lv/api/auth

Postman Collection Item JSON

{
  "name": "Autorizācijas talona atcelšana.",
  "request": {
    "method": "DELETE",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/api/auth",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "auth"
      ]
    }
  },
  "response": [
    {
      "name": "Autorizācijas talons atcelts.",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/auth",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "auth"
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{}"
    },
    {
      "name": "Lietotājs nav autentificēts.",
      "originalRequest": {
        "method": "DELETE",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/auth",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "auth"
          ]
        }
      },
      "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": "DELETE",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/auth",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "auth"
          ]
        }
      },
      "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": "DELETE",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/api/auth",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "auth"
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}