5.7.79. Bugzilla::User::APIKey

5.7.79.1. NAME

Bugzilla::User::APIKey - Model for an api key belonging to a user.

5.7.79.2. SYNOPSIS

use Bugzilla::User::APIKey;

my $api_key = Bugzilla::User::APIKey->new($id);
my $api_key = Bugzilla::User::APIKey->new({ name => $api_key });

# Class Functions
$user_api_key = Bugzilla::User::APIKey->create({
    description => $description,
});

5.7.79.3. DESCRIPTION

This package handles Bugzilla User::APIKey.

Bugzilla::User::APIKey is an implementation of Bugzilla::Object, and thus provides all the methods of Bugzilla::Object in addition to the methods listed below.

5.7.79.4. METHODS

Accessor Methods

  • id
The internal id of the api key.
  • user
The Bugzilla::User object that this api key belongs to.
  • user_id
The user id that this api key belongs to.
  • api_key
The API key, which is a random string.
  • description
An optional string that lets the user describe what a key is used for. For example: “Dashboard key”, “Application X key”.
  • revoked
If true, this api key cannot be used.
  • banned
If true, this api key has been revoked by an admin and cannot be used.
  • last_used
The date that this key was last used. undef if never used.
  • update_last_used
Updates the last used value to the current timestamp. This is updated even if the RPC call resulted in an error. It is not updated when the description or the revoked flag is changed.
  • set_description
Sets the new description
  • set_revoked
Sets the revoked flag
  • set_banned
Sets the banned flag, you must be in the admin group to set this field.
  • rejections
The number of times this API key has been rejected.
  • increment_rejections
Increment the number of times this API key has been rejected.
  • creation_ts
The timestamp for creation of this API key.
  • expires

The date the API key will expire in Year-Month-Day format.

This is 365 days after creation_ts.

5.7.79.5. CLASS FUNCTIONS

These are functions that are not called on a User object, but instead are called “statically,” just like a normal procedural function.

  • create

The same as “create” in Bugzilla::Object.

Params: description - What the key is used for
user_id - The uid of the user this key belongs to.

This documentation undoubtedly has bugs; if you find some, please file them here.