# 3.5.7. changesource

resource type: changesource
  Attributes:

    - changesourceid (integer) – the ID of this changesource

    - master? (master) – the master on which this worker is running, or None if it is inactive

    - name (string) – name of this changesource

A changesource generates change objects, for example in response to an update in some repository. A particular changesource (by name) runs on at most one master at a time.

## 3.5.7.1. Update Methods

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

class buildbot.data.changesources.ChangeSource
  findChangeSourceId(name)
    Parameters:

      name (string) – changesource name

    Returns:

      changesource ID via Deferred

    Get the ID for the given changesource name, inventing one if necessary.

  trySetChangeSourceMaster(changesourceid, masterid)
    Parameters:

      - changesourceid (integer) – changesource ID to try to claim

      - masterid (integer) – this master’s master ID

    Returns:

      `True` or `False`, via Deferred

    Try to claim the given scheduler for the given master and return `True` if the scheduler is to be activated on that master.

## 3.5.7.2. Endpoints

path: /changesources

This path selects all changesource

`GET`
  `returns`

    `collection` of `changesource`

path: /changesources/{changesourceid}
  Path Keys:

    changesourceid (number) – the id of a changesource

This path selects one changesource given its id

`GET`
  `returns`

    `collection` of `changesource`

path: /masters/{masterid}/changesources
  Path Keys:

    masterid (number) – the id of the master

This path selects all changesources for a given master

`GET`
  `returns`

    `collection` of `changesource`

path: /masters/{masterid}/changesources/{changesourceid}
  Path Keys:

    masterid (number) – the id of the master

This path selects one changesource by id for a given master

`GET`
  `returns`

    `collection` of `changesource`