Chilkat Online Tools

Ruby / WAC API / Get Utilizations for Control and Sub-Accounts

Back to Collection Items

require 'chilkat'

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

http = Chilkat::CkHttp.new()

queryParams = Chilkat::CkJsonObject.new()
queryParams.UpdateString("from","2023-01-01")
queryParams.UpdateString("to","2023-07-25")

http.SetRequestHeader("Authorization","{{WACApiKey}}")

# resp is a CkHttpResponse
resp = http.QuickRequestParams("GET","https://domain.com/v1/utilizations",queryParams)
if (http.get_LastMethodSuccess() == false)
    print http.lastErrorText() + "\n";
    exit
end

print resp.get_StatusCode().to_s() + "\n";
print resp.bodyStr() + "\n";

Curl Command

curl -G -d "from=2023-01-01"
	-d "to=2023-07-25"
	-H "Authorization: {{WACApiKey}}"
https://domain.com/v1/utilizations

Postman Collection Item JSON

{
  "name": "Get Utilizations for Control and Sub-Accounts",
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Authorization",
        "value": "{{WACApiKey}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{baseURL}}/v1/utilizations?from=2023-01-01&to=2023-07-25",
      "host": [
        "{{baseURL}}"
      ],
      "path": [
        "v1",
        "utilizations"
      ],
      "query": [
        {
          "key": "from",
          "value": "2023-01-01"
        },
        {
          "key": "to",
          "value": "2023-07-25"
        }
      ]
    }
  },
  "response": [
  ]
}