Chilkat Online Tools

DataFlex / Zoom API / Update E911 digital signage

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vReq
    Handle hoReq
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sEvent_id
    String sTemp1
    Boolean bTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Get Create (RefClass(cComChilkatHttpRequest)) To hoReq
    If (Not(IsComObjectCreated(hoReq))) Begin
        Send CreateComObject of hoReq
    End
    Set ComHttpVerb Of hoReq To "PATCH"
    Set ComPath Of hoReq To "/v2/rooms/events"
    Set ComContentType Of hoReq To "multipart/form-data"
    Send ComAddParam To hoReq "method" "zoomroom.emergency_alert_displayed"

    Send ComAddParam To hoReq "params" 'zoomroom.emergency_alert_displayed{"content":"anim dolore veniam dolore","target_ids":["laborum commodo est in"],"target_type":"location"}'

    Send ComAddHeader To hoReq "Authorization" "Bearer <access_token>"

    Get pvComObject of hoReq to vReq
    Get ComSynchronousRequest Of hoHttp "api.zoom.us" 443 True vReq To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComStatusCode Of hoResp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComHeader Of hoResp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Send Destroy of hoResp
        Procedure_Return
    End

    Send Destroy of hoResp

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

    // {
    //   "event_id": "6354hgfsdj34"
    // }

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

    Get ComStringOf Of hoJResp "event_id" To sEvent_id


End_Procedure

Curl Command

curl -X PATCH
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: multipart/form-data"
	--form 'method=zoomroom.emergency_alert_displayed'
	--form 'params=zoomroom.emergency_alert_displayed{"content":"anim dolore veniam dolore","target_ids":["laborum commodo est in"],"target_type":"location"}'
https://api.zoom.us/v2/rooms/events

Postman Collection Item JSON

{
  "name": "Update E911 digital signage",
  "request": {
    "method": "PATCH",
    "header": [
      {
        "key": "Content-Type",
        "value": "multipart/form-data"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "method",
          "value": "zoomroom.emergency_alert_displayed",
          "type": "text"
        },
        {
          "key": "params",
          "value": "{\"content\":\"anim dolore veniam dolore\",\"target_ids\":[\"laborum commodo est in\"],\"target_type\":\"location\"}",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/rooms/events",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "rooms",
        "events"
      ]
    },
    "description": "Display or hide E911 emergency alert text content from [Zoom Rooms digital signage](https://support.zoom.us/hc/en-us/articles/360000030683-Zoom-Rooms-digital-signage).\n\n**Scope:** `room:write:admin`\n\n**Prerequisites:**<br>\n* [Zoom Rooms](https://zoom.us/zoomrooms/software) 5.3.0 or higher\n* Zoom Rooms digital signage must be [enabled](https://support.zoom.us/hc/en-us/articles/360000030683-Zoom-Rooms-Digital-Signage#h_767fbb33-82a8-45a8-8392-a1bfa9687edd)\n"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `202` <br>",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "method",
              "value": "zoomroom.emergency_alert_displayed",
              "type": "text"
            },
            {
              "key": "params",
              "value": "{\"content\":\"anim dolore veniam dolore\",\"target_ids\":[\"laborum commodo est in\"],\"target_type\":\"location\"}",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/rooms/events",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "rooms",
            "events"
          ]
        }
      },
      "status": "Accepted",
      "code": 202,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"event_id\": \"6354hgfsdj34\"\n}"
    },
    {
      "name": "**HTTP Status Code:** `400` <br>\n\n**Error Code:** `200` <br> Access restricted. <br><br>\n**Error Code:** `300`\nEvent id is required.<br>\nInvalid value submitted for Target Ids. Provide a valid Target Id associated with the Target type.",
      "originalRequest": {
        "method": "PATCH",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "method",
              "value": "zoomroom.emergency_alert_displayed",
              "type": "text"
            },
            {
              "key": "params",
              "value": "{\"content\":\"anim dolore veniam dolore\",\"target_ids\":[\"laborum commodo est in\"],\"target_type\":\"location\"}",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/rooms/events",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "rooms",
            "events"
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}