NAME
WebService::Bugzilla::Attachment - Bugzilla Attachment object and service
VERSION
version 0.001
SYNOPSIS
# Fetch an attachment by ID
my $att = $bz->attachment->get(42);
say $att->filename, ' (', $att->content_type, ')';
# List attachments on a bug
my $list = $bz->attachment->search(bug_id => 12345);
# Create a new attachment
my $new = $bz->attachment->create(12345,
file_name => 'patch.diff',
content_type => 'text/plain',
data => $base64_data,
summary => 'Proposed fix',
);
# Update metadata
$att->update(is_obsolete => 1);
DESCRIPTION
Provides access to the Bugzilla Attachment API. Attachment objects represent file attachments on bugs and expose read-only attributes about the file plus helper methods to create, fetch, search, and update attachments.
ATTRIBUTES
All attributes are read-only and lazy. Accessing any attribute on a stub object triggers a single API call that populates every field at once.
bug_id-
The ID of the bug this attachment belongs to.
content_type-
MIME content type of the attachment (e.g.
text/plain). creation_time-
ISO 8601 datetime when the attachment was created.
creator-
Login name of the user who created the attachment.
description-
Short description / summary of the attachment.
filename-
The on-disk filename of the attachment.
is_obsolete-
Boolean. Whether the attachment has been marked obsolete.
is_patch-
Boolean. Whether the attachment is a patch.
is_private-
Boolean. Whether the attachment is private (visible only to insiders).
last_change_time-
ISO 8601 datetime of the most recent change.
size-
Size of the attachment in bytes.
METHODS
BUILDARGS
Moo around modifier. Normalises the incoming construction arguments so that the Bugzilla-native file_name key is accepted as an alias for the filename attribute.
create
my $att = $bz->attachment->create($bug_id, %params);
Create a new attachment on the given bug. See POST /rest/bug/{id}/attachment.
Returns a stub WebService::Bugzilla::Attachment with the new id.
get
my $att = $bz->attachment->get($attachment_id);
Fetch a single attachment by its numeric ID. See GET /rest/bug/attachment/{id}.
Returns a WebService::Bugzilla::Attachment, or undef if not found.
search
my $list = $bz->attachment->search(bug_id => $id);
Retrieve all attachments for the specified bug. See GET /rest/bug/{id}/attachment.
Returns an arrayref of WebService::Bugzilla::Attachment objects.
update
my $updated = $att->update(%params);
my $updated = $bz->attachment->update($id, %params);
Update attachment metadata. See PUT /rest/attachment/{id}.
Returns a WebService::Bugzilla::Attachment with the updated data.
SEE ALSO
WebService::Bugzilla - main client
WebService::Bugzilla::Bug - bug objects
https://bmo.readthedocs.io/en/latest/api/core/v1/attachment.html - Bugzilla Attachment REST API
AUTHOR
Dean Hamstead <dean@fragfest.com.au>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2026 by Dean Hamstead.
This is free software, licensed under:
The MIT (X11) License