Chilkat Online Tools

Swift3 / Zoom API / Get billing information

Back to Collection Items

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

    let http = CkoHttp()!
    var success: Bool

    // Adds the "Authorization: Bearer <access_token>" header.
    http.authToken = "<access_token>"

    let sbResponseBody = CkoStringBuilder()!
    success = http.quickGetSb("https://api.zoom.us/v2/accounts/:accountId/billing", sbContent: sbResponseBody)
    if success == false {
        print("\(http.lastErrorText!)")
        return
    }

    let jResp = CkoJsonObject()!
    jResp.loadSb(sbResponseBody)
    jResp.emitCompact = false

    print("Response Body:")
    print("\(jResp.emit()!)")

    var respStatusCode: Int = http.lastStatus.intValue
    print("Response Status Code = \(respStatusCode)")
    if respStatusCode >= 400 {
        print("Response Header:")
        print("\(http.lastHeader!)")
        print("Failed.")
        return
    }

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

    // {
    //   "first_name": "string",
    //   "last_name": "string",
    //   "email": "string",
    //   "phone_number": "string",
    //   "address": "string",
    //   "apt": "string",
    //   "city": "string",
    //   "state": "string",
    //   "zip": "string",
    //   "country": "string"
    // }

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

    var first_name: String? = jResp.string(of: "first_name")
    var last_name: String? = jResp.string(of: "last_name")
    var email: String? = jResp.string(of: "email")
    var phone_number: String? = jResp.string(of: "phone_number")
    var address: String? = jResp.string(of: "address")
    var apt: String? = jResp.string(of: "apt")
    var city: String? = jResp.string(of: "city")
    var state: String? = jResp.string(of: "state")
    var zip: String? = jResp.string(of: "zip")
    var country: String? = jResp.string(of: "country")

}

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://api.zoom.us/v2/accounts/:accountId/billing

Postman Collection Item JSON

{
  "name": "Get billing information",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/accounts/:accountId/billing",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "accounts",
        ":accountId",
        "billing"
      ],
      "variable": [
        {
          "key": "accountId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) The account's ID."
        }
      ]
    },
    "description": "Get [billing information](https://support.zoom.us/hc/en-us/articles/201363263-About-Billing) of a sub account.<br><br>Only master accounts can use this API. Zoom allows only [approved partners](https://marketplace.zoom.us/docs/api-reference/master-account-apis) to use master APIs and manage sub accounts' billing information. Email the partner programs team at **partner-success@zoom.us** for more details.<br>\n\n**Prerequisites:**\n* Pro or a higher paid account with master account option enabled. <br>\n\n**Scope**:`billing:master`, `billing_plan:read:admin`<br>\n**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `200`<br>\nAccount billing contact information returned.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId/billing",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId",
            "billing"
          ],
          "variable": [
            {
              "key": "accountId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The account's ID."
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"first_name\": \"string\",\n \"last_name\": \"string\",\n \"email\": \"string\",\n \"phone_number\": \"string\",\n \"address\": \"string\",\n \"apt\": \"string\",\n \"city\": \"string\",\n \"state\": \"string\",\n \"zip\": \"string\",\n \"country\": \"string\"\n}"
    },
    {
      "name": "**HTTP Status Code:** `400`<br>\n**Error Code:** `2100`<br> \nThis sub account is on self pay mode.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId/billing",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId",
            "billing"
          ],
          "variable": [
            {
              "key": "accountId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The account's ID."
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `404`<br>\n**Error Code:** `2001`<br>\nAccount does not exist: {subAccountId}.\n\n\n",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/accounts/:accountId/billing",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "accounts",
            ":accountId",
            "billing"
          ],
          "variable": [
            {
              "key": "accountId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The account's ID."
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}