Chilkat Online Tools

autoit / Anypoint Platform APIs / Get all load balancers

Back to Collection Items

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

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

$oHttp.SetRequestHeader "X-ANYPNT-ENV-ID","{{environment_id}}"
; Adds the "Authorization: Bearer {{token}}" header.
$oHttp.AuthToken = "{{token}}"
$oHttp.SetRequestHeader "X-ANYPNT-ORG-ID","{{organization_id}}"

$oSbResponseBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$bSuccess = $oHttp.QuickGetSb("https://domain.com/cloudhub/api/organizations/{{organization_id}}/loadbalancers",$oSbResponseBody)
If ($bSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("Response status code = " & $oHttp.LastStatus & @CRLF)
ConsoleWrite($oSbResponseBody.GetAsString() & @CRLF)

Curl Command

curl -X GET
	-H "Authorization: Bearer {{token}}"
	-H "X-ANYPNT-ORG-ID: {{organization_id}}"
	-H "X-ANYPNT-ENV-ID: {{environment_id}}"
https://domain.com/cloudhub/api/organizations/{{organization_id}}/loadbalancers

Postman Collection Item JSON

{
  "name": "Get all load balancers",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{token}}",
        "type": "text"
      },
      {
        "key": "X-ANYPNT-ORG-ID",
        "value": "{{organization_id}}",
        "type": "text"
      },
      {
        "key": "X-ANYPNT-ENV-ID",
        "value": "{{environment_id}}",
        "type": "text"
      }
    ],
    "url": {
      "raw": "{{url}}/cloudhub/api/organizations/{{organization_id}}/loadbalancers",
      "host": [
        "{{url}}"
      ],
      "path": [
        "cloudhub",
        "api",
        "organizations",
        "{{organization_id}}",
        "loadbalancers"
      ]
    }
  },
  "response": [
  ]
}