Chilkat Online Tools

lianja / easybill REST API / /logins/:id

Back to Collection Items

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

loHttp = createobject("CkHttp")

loHttp.SetRequestHeader("Authorization","{{apiKey}}")
loHttp.SetRequestHeader("Accept","application/json")

loSbResponseBody = createobject("CkStringBuilder")
llSuccess = loHttp.QuickGetSb("https://api.easybill.de/rest/v1/logins/:id",loSbResponseBody)
if (llSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loSbResponseBody
    return
endif

loJResp = createobject("CkJsonObject")
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = .F.

? "Response Body:"
? loJResp.Emit()

lnRespStatusCode = loHttp.LastStatus
? "Response Status Code = " + str(lnRespStatusCode)
if (lnRespStatusCode >= 400) then
    ? "Response Header:"
    ? loHttp.LastHeader
    ? "Failed."
    release loHttp
    release loSbResponseBody
    release loJResp
    return
endif

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

// {
//   "id": "<long>",
//   "first_name": "<string>",
//   "last_name": "<string>",
//   "display_name": "<string>",
//   "phone": "<string>",
//   "email": "<string>",
//   "email_signature": "<string>",
//   "login_type": "ASSISTANT",
//   "locale": "<string>",
//   "time_zone": "<string>",
//   "security": {
//     "two_factor_enabled": false,
//     "recovery_codes_enabled": false,
//     "notify_on_new_login_enabled": true
//   }
// }

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

lcId = loJResp.StringOf("id")
lcFirst_name = loJResp.StringOf("first_name")
lcLast_name = loJResp.StringOf("last_name")
lcDisplay_name = loJResp.StringOf("display_name")
lcPhone = loJResp.StringOf("phone")
lcEmail = loJResp.StringOf("email")
lcEmail_signature = loJResp.StringOf("email_signature")
lcLogin_type = loJResp.StringOf("login_type")
lcLocale = loJResp.StringOf("locale")
lcTime_zone = loJResp.StringOf("time_zone")
llTwo_factor_enabled = loJResp.BoolOf("security.two_factor_enabled")
llRecovery_codes_enabled = loJResp.BoolOf("security.recovery_codes_enabled")
llNotify_on_new_login_enabled = loJResp.BoolOf("security.notify_on_new_login_enabled")


release loHttp
release loSbResponseBody
release loJResp

Curl Command

curl -X GET
	-H "Authorization: {{apiKey}}"
	-H "Accept: application/json"
https://api.easybill.de/rest/v1/logins/:id

Postman Collection Item JSON

{
  "name": "/logins/:id",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Accept",
        "value": "application/json"
      }
    ],
    "url": {
      "raw": "{{baseUrl}}/logins/:id",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "logins",
        ":id"
      ],
      "variable": [
        {
          "key": "id",
          "value": "<long>",
          "description": "(Required) ID of the login that needs to be fetched"
        }
      ]
    }
  },
  "response": [
    {
      "name": "Successful operation",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "key": "Accept",
            "value": "application/json"
          },
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/logins/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "logins",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n  \"id\": \"<long>\",\n  \"first_name\": \"<string>\",\n  \"last_name\": \"<string>\",\n  \"display_name\": \"<string>\",\n  \"phone\": \"<string>\",\n  \"email\": \"<string>\",\n  \"email_signature\": \"<string>\",\n  \"login_type\": \"ASSISTANT\",\n  \"locale\": \"<string>\",\n  \"time_zone\": \"<string>\",\n  \"security\": {\n    \"two_factor_enabled\": false,\n    \"recovery_codes_enabled\": false,\n    \"notify_on_new_login_enabled\": true\n  }\n}"
    },
    {
      "name": "Too Many Requests",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: apikey",
            "key": "Authorization",
            "value": "<API Key>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/logins/:id",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "logins",
            ":id"
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Too Many Requests",
      "code": 429,
      "_postman_previewlanguage": "text",
      "header": [
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}