Chilkat Online Tools

C / Zoom API / Change the assigned parent location

Back to Collection Items

#include <C_CkHttp.h>
#include <C_CkHttpRequest.h>
#include <C_CkHttpResponse.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkHttpRequest req;
    HCkHttpResponse resp;
    HCkStringBuilder sbResponseBody;
    HCkJsonObject jResp;
    int respStatusCode;

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

    http = CkHttp_Create();

    req = CkHttpRequest_Create();
    CkHttpRequest_putHttpVerb(req,"PUT");
    CkHttpRequest_putPath(req,"/v2/rooms/locations/:locationId/location");
    CkHttpRequest_putContentType(req,"multipart/form-data");
    CkHttpRequest_AddParam(req,"parent_location_id","cillum aute");

    CkHttpRequest_AddHeader(req,"Authorization","Bearer <access_token>");

    resp = CkHttp_SynchronousRequest(http,"api.zoom.us",443,TRUE,req);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkHttpRequest_Dispose(req);
        return;
    }

    sbResponseBody = CkStringBuilder_Create();
    CkHttpResponse_GetBodySb(resp,sbResponseBody);

    jResp = CkJsonObject_Create();
    CkJsonObject_LoadSb(jResp,sbResponseBody);
    CkJsonObject_putEmitCompact(jResp,FALSE);

    printf("Response Body:\n");
    printf("%s\n",CkJsonObject_emit(jResp));

    respStatusCode = CkHttpResponse_getStatusCode(resp);
    printf("Response Status Code = %d\n",respStatusCode);
    if (respStatusCode >= 400) {
        printf("Response Header:\n");
        printf("%s\n",CkHttpResponse_header(resp));
        printf("Failed.\n");
        CkHttpResponse_Dispose(resp);
        CkHttp_Dispose(http);
        CkHttpRequest_Dispose(req);
        CkStringBuilder_Dispose(sbResponseBody);
        CkJsonObject_Dispose(jResp);
        return;
    }

    CkHttpResponse_Dispose(resp);


    CkHttp_Dispose(http);
    CkHttpRequest_Dispose(req);
    CkStringBuilder_Dispose(sbResponseBody);
    CkJsonObject_Dispose(jResp);

    }

Curl Command

curl -X PUT
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: multipart/form-data"
	--form 'parent_location_id=cillum aute'
https://api.zoom.us/v2/rooms/locations/:locationId/location

Postman Collection Item JSON

{
  "name": "Change the assigned parent location",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "PUT",
    "header": [
      {
        "key": "Content-Type",
        "value": "multipart/form-data"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "parent_location_id",
          "value": "cillum aute",
          "description": "Location ID of the new Parent Location under which you the child location will be positioned. This can be retrieved from the [List Zoom Room Locations](https://marketplace.zoom.us/docs/api-reference/zoom-api/rooms-location/listzrlocations) API.",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/rooms/locations/:locationId/location",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "rooms",
        "locations",
        ":locationId",
        "location"
      ],
      "variable": [
        {
          "key": "locationId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) "
        }
      ]
    },
    "description": "An account owner of a Zoom account can establish a [Zoom Rooms Location Hierarchy](https://support.zoom.us/hc/en-us/articles/115000342983-Zoom-Rooms-Location-Hierarchy) to better organize Zoom Rooms spread accross various location. The location can be structured in a hierarchy with Country being the top-level location, followed by city, campus, building, and floor. The location in the lower level in the hierarchy is considered as a child of the location that is a level above in the hierarchy. Use this API to change the parent location of a child location. <br><br> For instance, if the location hierarchy is structured in a way where there are two campuses (Campus 1, and Campus 2) in a City and Campus 1 consists of a building named Building 1 with a floor where Zoom Rooms are located, and you would like to rearrange the structure so that Building 1 along with its child locations (floor and Zoom Rooms) are relocated directly under Campus 2 instead of Campus 1, you must provide the location ID of Building 1 in the path parameter of this request and the location ID of Campus 2 as the value of `parent_location_id` in the  request body.<br><br>\n**Prerequisite:**<br>\n* Account owner or admin permission\n* Zoom Rooms version 4.0 or higher<br>\n**Scopes:** `room:write:admin`<br><br> \n **[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `204` **No Content**<br>\nLocation assigned successfully.",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "parent_location_id",
              "value": "cillum aute",
              "description": "Location ID of the new Parent Location under which you the child location will be positioned. This can be retrieved from the [List Zoom Room Locations](https://marketplace.zoom.us/docs/api-reference/zoom-api/rooms-location/listzrlocations) API.",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/rooms/locations/:locationId/location",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "rooms",
            "locations",
            ":locationId",
            "location"
          ],
          "variable": [
            {
              "key": "locationId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) "
            }
          ]
        }
      },
      "status": "No Content",
      "code": 204,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{}"
    },
    {
      "name": "**HTTP Status Code:** `400` **Bad Request**<br><br>\n**Error Code:** `200`<br> Zoom Room subscription not found. Try again after purchasing a Zoom Room subscription.<br>\n**Error Code:** `300`<br> Invalid parent location id {parent_location_id}",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "parent_location_id",
              "value": "cillum aute",
              "description": "Location ID of the new Parent Location under which you the child location will be positioned. This can be retrieved from the [List Zoom Room Locations](https://marketplace.zoom.us/docs/api-reference/zoom-api/rooms-location/listzrlocations) API.",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/rooms/locations/:locationId/location",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "rooms",
            "locations",
            ":locationId",
            "location"
          ],
          "variable": [
            {
              "key": "locationId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) "
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `404` **Not Found**<br><br>\n**Error Code:** `4801`<br> Location not found:{parent_location_id}.\n",
      "originalRequest": {
        "method": "PUT",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "parent_location_id",
              "value": "cillum aute",
              "description": "Location ID of the new Parent Location under which you the child location will be positioned. This can be retrieved from the [List Zoom Room Locations](https://marketplace.zoom.us/docs/api-reference/zoom-api/rooms-location/listzrlocations) API.",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/rooms/locations/:locationId/location",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "rooms",
            "locations",
            ":locationId",
            "location"
          ],
          "variable": [
            {
              "key": "locationId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) "
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}