Get attachments

GET https://acp.wardcrew.org/api/v1/attachments

Fetch metadata on files uploaded by the requesting user.

Usage examples

#!/usr/bin/env python3

import zulip

# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")

# Get your attachments.
result = client.get_attachments()
print(result)

The -u line implements HTTP Basic authentication. See the Authorization header documentation for how to get those credentials for Zulip users and bots.

curl -sSX GET -G https://acp.wardcrew.org/api/v1/attachments \
    -u EMAIL_ADDRESS:API_KEY

Parameters

This endpoint does not accept any parameters.

Response

Return values

  • attachments: (object)[]

    A list of attachment objects, each containing details about a file uploaded by the user.

    • id: integer

      The unique ID for the attachment.

    • name: string

      Name of the uploaded file.

    • path_id: string

      A representation of the path of the file within the repository of user-uploaded files. If the path_id of a file is {realm_id}/ab/cdef/temp_file.py, its URL will be: {server_url}/user_uploads/{realm_id}/ab/cdef/temp_file.py.

    • size: integer

      Size of the file in bytes.

    • create_time: integer

      Time when the attachment was uploaded as a UNIX timestamp.

      Changes: Before Zulip 12.0 (feature level 443), this value was milliseconds since the epoch, not seconds.

      Changed in Zulip 3.0 (feature level 22). This field was previously a floating point number.

    • message_ids: (integer)[]

      Array containing the IDs of messages that reference this uploaded file. This includes messages sent by any user in the Zulip organization who sent a message containing a link to the uploaded file.

      Changes: In Zulip 12.0 (feature level 472), this replaced the previous messages field, which was an array of objects containing both id and date_sent properties.

  • upload_space_used: integer

    The total size of all files uploaded by users in the organization, in bytes.

Example response(s)

Changes: As of Zulip 7.0 (feature level 167), if any parameters sent in the request are not supported by this endpoint, a successful JSON response will include an ignored_parameters_unsupported array.

A typical successful JSON response may look like:

{
    "attachments": [
        {
            "create_time": 1588145417,
            "id": 1,
            "message_ids": [
                102,
                103
            ],
            "name": "166050.jpg",
            "path_id": "2/ce/DfOkzwdg_IwlrN3myw3KGtiJ/166050.jpg",
            "size": 571946
        }
    ],
    "msg": "",
    "result": "success",
    "upload_space_used": 571946
}