# 3.5.2. buildrequest

resource type: buildrequest
  Attributes:

    - buildrequestid (integer) – the unique ID of this buildrequest

    - builderid (integer) – the id of the builder linked to this buildrequest

    - buildsetid (integer) – the id of the buildset that contains this buildrequest

    - claimed (boolean) – True if this buildrequest has been claimed. Note that this is a calculated field (from claimed_at != None). Ordering by this field is not optimized by the database layer.

    - claimed_at? (date) – time at which this build has last been claimed. None if this buildrequest has never been claimed or has been unclaimed

    - claimed_by_masterid? (integer) – the id of the master that claimed this buildrequest. None if this buildrequest has never been claimed or has been unclaimed

    - complete (boolean) – true if this buildrequest is complete

    - complete_at? (date) – time at which this buildrequest was completed, or None if it’s still running

    - priority (integer) – the priority of this buildrequest

    - properties? (sourcedproperties) – a dictionary of properties corresponding to buildrequest.

    - results? (integer) – the results of this buildrequest (see Build Result Codes), or None if not complete

    - submitted_at (date) – time at which this buildrequest was submitted

    - waited_for (boolean) – True if the entity that triggered this buildrequest is waiting for it to complete. Should be used by an (unimplemented so far) clean shutdown to only start br that are waited_for.

This resource type describes completed and in-progress buildrequests. Much of the contextual data for a buildrequest is associated with the buildset that contains this buildrequest.

## 3.5.2.1. Update Methods

All update methods are available as attributes of `master.data.updates`.

class buildbot.data.buildrequests.BuildRequest
  claimBuildRequests(brids, claimed_at=None)
    Parameters:

      - brids (list(integer)) – list of buildrequest id to claim

      - claimed_at (datetime) – date and time when the buildrequest is claimed

    Returns:

      (boolean) whether claim succeeded or not

    Claim a list of buildrequests

  unclaimBuildRequests(brids)
    Parameters:

      brids (list(integer)) – list of buildrequest id to unclaim

    Unclaim a list of buildrequests

  completeBuildRequests(brids, results, complete_at=None)
    Parameters:

      - brids (list(integer)) – list of buildrequest id to complete

      - results (integer) – the results of the buildrequest (see Build Result Codes)

      - complete_at (datetime) – date and time when the buildrequest is completed

    Complete a list of buildrequest with the `results` status

## 3.5.2.2. Endpoints

path: /builders/{builderid_or_buildername}/buildrequests
  Path Keys:

    builderid_or_buildername (number|string) – the ID or name of the builder

This path selects all buildrequests for a given builder (can return lots of data!)

`GET`
  `returns`

    `collection` of `buildrequest`

path: /buildrequests

`GET`
  `returns`

    `collection` of `buildrequest`

path: /buildrequests/{buildrequestid}
  Path Keys:

    buildrequestid (number) – the id of the buildrequest

`GET`
  `returns`

    `collection` of `buildrequest`

POST with method: /buildrequests/{buildrequestid} (method=cancel)
  Body keys:

    - method (string) – must be `cancel`

    - reason (string) – The reason why the buildrequest was cancelled

POST with method: /buildrequests/{buildrequestid} (method=set_priority)
  Body keys:

    - method (string) – must be `set_priority`

    - priority (int) – The new priority for the buildrequest