Chilkat Online Tools

TCL / Zoom API / Upload a user's profile picture

Back to Collection Items

load ./chilkat.dll

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

set http [new_CkHttp]

set req [new_CkHttpRequest]

CkHttpRequest_put_HttpVerb $req "POST"
CkHttpRequest_put_Path $req "/v2/users/:userId/picture"
CkHttpRequest_put_ContentType $req "multipart/form-data"
set success [CkHttpRequest_AddFileForUpload2 $req "pic_file" " path to file" "application/octet-stream"]

CkHttpRequest_AddHeader $req "Authorization" "Bearer <access_token>"
CkHttpRequest_AddHeader $req "Expect" "100-continue"

# resp is a CkHttpResponse
set resp [CkHttp_SynchronousRequest $http "api.zoom.us" 443 1 $req]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkHttpRequest $req
    exit
}

puts [CkHttpResponse_get_StatusCode $resp]
puts [CkHttpResponse_bodyStr $resp]
delete_CkHttpResponse $resp


delete_CkHttp $http
delete_CkHttpRequest $req

Curl Command

curl -X POST
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: multipart/form-data"
	--form 'pic_file=@"/path/to/file"'
https://api.zoom.us/v2/users/:userId/picture

Postman Collection Item JSON

{
  "name": "Upload a user's profile picture",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Content-Type",
        "value": "multipart/form-data"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "pic_file",
          "description": "(Required) The file's path. ",
          "type": "file",
          "src": [
          ]
        }
      ]
    },
    "url": {
      "raw": "{{baseUrl}}/users/:userId/picture",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "users",
        ":userId",
        "picture"
      ],
      "variable": [
        {
          "key": "userId",
          "value": "quis officia in reprehenderit",
          "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
        }
      ]
    },
    "description": "Upload a user's profile picture. For user-level apps, pass [the `me` value](https://marketplace.zoom.us/docs/api-reference/using-zoom-apis#mekeyword) instead of the `userId` parameter.\n\nProvide `multipart/form-data` as the value of the `content-type` header for this request. This API supports `.jpeg` and `.png` file formats.\n\n**Scopes:** `user:write:admin`, `user:write`<br>**[Rate Limit Label](https://marketplace.zoom.us/docs/api-reference/rate-limits#rate-limits):** `Medium`"
  },
  "response": [
    {
      "name": "**HTTP Status Code:** `201`<br>Picture uploaded.",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "pic_file",
              "description": "(Required) The file's path. ",
              "type": "file",
              "src": [
              ]
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/users/:userId/picture",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId",
            "picture"
          ],
          "variable": [
            {
              "key": "userId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
            }
          ]
        }
      },
      "status": "Created",
      "code": 201,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Location",
          "value": "quis officia in reprehenderit",
          "description": "Location of user's picture"
        },
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "**HTTP Status Code:** `400`<br>\nBad request<br>\n**Error Code:** `300`<br>\nYour request was not accepted because the profile picture contains invalid or explicit content.<br>\n**Error Code:** `200`<br>\nOnly an account administrator can change a profile pict",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "pic_file",
              "description": "(Required) The file's path. ",
              "type": "file",
              "src": [
              ]
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/users/:userId/picture",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId",
            "picture"
          ],
          "variable": [
            {
              "key": "userId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
            }
          ]
        }
      },
      "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:** `1001`<br>\nUser does not exist: $userId.\n",
      "originalRequest": {
        "method": "POST",
        "header": [
          {
            "description": "Added as a part of security scheme: oauth2",
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "body": {
          "mode": "formdata",
          "formdata": [
            {
              "key": "pic_file",
              "description": "(Required) The file's path. ",
              "type": "file",
              "src": [
              ]
            }
          ]
        },
        "url": {
          "raw": "{{baseUrl}}/users/:userId/picture",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "users",
            ":userId",
            "picture"
          ],
          "variable": [
            {
              "key": "userId",
              "value": "quis officia in reprehenderit",
              "description": "(Required) The user ID or email address of the user. For user-level apps, pass the `me` value for this parameter."
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}