# RepositoryService

Provides access to the Deployit repository.

GET | /repository/ci/{ID:.*?} | Reads a configuration item from the repository.
POST | /repository/ci/{ID:.*?} | Creates a new configuration item.
POST | /repository/ci/{ID:.*?} | Creates a new artifact CI with data.
PUT | /repository/ci/{ID:.*?} | Modifies a configuration item.
PUT | /repository/ci/{ID:.*?} | Modifies an artifact (upload new data).
DELETE | /repository/ci/{ID:.*?} | Deletes a configuration item.
POST | /repository/cis | Creates multiple configuration items.
PUT | /repository/cis | Modifies multiple configuration items.
POST | /repository/cis/read | Reads multiple configuration items from the repository.
POST | /repository/copy/{ID:.*?} | Copy a configuration item in the repository.
GET | /repository/exists/{ID:.*?} | Checks if a configuration item exists.
POST | /repository/move/{ID:.*?} | Moves a configuration item in the repository.
GET | /repository/query | Retrieves configuration items by way of a query.
POST | /repository/rename/{ID:.*?} | Changes the name of a configuration item in the repository.
POST | /repository/validate | Validate the configuration items, returning any validation errors found.

## GET /repository/ci/{ID:.*?}

Reads a configuration item from the repository.

Permissions
  `read`

Parameters

  Path | ID | String | the ID of the CI

Response body
  ConfigurationItem - the CI, or a `404` error code if not found.
  Content type: application/xml, application/json

## POST /repository/ci/{ID:.*?}

Creates a new configuration item.

Permissions
  `repo#edit`

Parameters

  Path | ID | String | the ID/path of the new CI.
  Request body | application/xml, application/json | ConfigurationItem | the data of the CI.

Response body
  ConfigurationItem - the newly created CI
  Content type: application/xml, application/json

## POST /repository/ci/{ID:.*?}

Creates a new artifact CI with data.

Permissions
  `repo#edit`

Parameters

  Path | ID | String | the ID/path of the new artifact.
  Multipart |  | ArtifactAndData | the data of the artifact.

Response body
  ConfigurationItem - the newly created artifact
  Content type: application/xml, application/json

## PUT /repository/ci/{ID:.*?}

Modifies a configuration item.

Permissions
  `repo#edit`

Parameters

  Path | ID | String | the ID of the CI to modify.
  Request body | application/xml, application/json | ConfigurationItem | the new data of the CI.

Response body
  ConfigurationItem - the updated CI, or a `409` error code if the CI has been updated on the server and you are sending modifications on an old version.
  Content type: application/xml, application/json

## PUT /repository/ci/{ID:.*?}

Modifies an artifact (upload new data).

Permissions
  `repo#edit`

Parameters

  Path | ID | String | the ID of the artifact to modify.
  Multipart |  | ArtifactAndData | the new data of the artifact.

Response body
  ConfigurationItem - the updated artifact, or a `409` error code if the CI has been updated on the server and you are sending modifications on an old version.
  Content type: application/xml, application/json

## DELETE /repository/ci/{ID:.*?}

Deletes a configuration item.

Permissions
  `repo#edit`
  `import#remove`

Parameters

  Path | ID | String | the ID of the CI to delete.

Response body
  Empty

## POST /repository/cis

Creates multiple configuration items.

Permissions
  `repo#edit`

Parameters

  Request body | application/xml, application/json | List of ConfigurationItem | the data of the CIs.

Response body
  List of ConfigurationItem - the newly created CIs
  Content type: application/xml, application/json

## PUT /repository/cis

Modifies multiple configuration items.

Permissions
  `repo#edit`

Parameters

  Request body | application/xml, application/json | List of ConfigurationItem | the new data of the CIs.

Response body
  List of ConfigurationItem - the updated CIs, or a `409` error code if one of the CIs has been updated on the server and you are sending modifications on an old version.
  Content type: application/xml, application/json

## POST /repository/cis/read

Reads multiple configuration items from the repository.

Permissions
  `read`

Parameters

  Request body | application/xml, application/json | List of String | the ids of the CIs

Response body
  List of ConfigurationItem - the CIs, or a `404` error code if one of them was not found.
  Content type: application/xml, application/json

## POST /repository/copy/{ID:.*?}

Copy a configuration item in the repository. The item as well as all its children are copied to the new location. The parent reflected in the new location, must be of the same type as that of the parent of the item being copied.

Permissions
  `repo#edit`

Parameters

  Path | ID | String | the ID of the CI to copy
  Query | newId | String | the new ID of the copied CI, reflecting the path in the repository.

Response body
  ConfigurationItem - the copied CI
  Content type: application/xml, application/json

## GET /repository/exists/{ID:.*?}

Checks if a configuration item exists.

Parameters

  Path | ID | String | the ID of the CI to check

Response body
  Boolean - `true` if the CI exists, `false` if not.
  Content type: application/xml, application/json

## POST /repository/move/{ID:.*?}

Moves a configuration item in the repository.

Permissions
  `repo#edit`

Parameters

  Path | ID | String | the ID of the CI to move
  Query | newId | String | the new ID of the CI, reflecting the path in the repository.

Response body
  ConfigurationItem - the moved CI
  Content type: application/xml, application/json

## GET /repository/query

Retrieves configuration items by way of a query. All parameters are optional.

Parameters

  Query | type | Type | the type of the CI
  Query | parent | String | the parent ID of the CI. If set, only the subtree of this CI is searched.
  Query | namePattern | String | a search pattern for the name. This is like the SQL "LIKE" pattern: the character '%' represents any string of zero or more characters, and the character '_' (underscore) represents any single character. Any literal use of these two characters must be escaped with a backslash ('\'). Consequently, any literal instance of a backslash must also be escaped, resulting in a double backslash ('\\').
  Query | lastModifiedBefore | DateTime | look for CIs modified before this date.
  Query | lastModifiedAfter | DateTime | look for CIs modified after this date.
  Query | page | long | the desired page, in case of a paged query.
  Query | resultsPerPage | long | the page size, or `-1` for no paging.

Response body
  List of ConfigurationItemId - a list of references to CIs
  Content type: application/xml, application/json

## POST /repository/rename/{ID:.*?}

Changes the name of a configuration item in the repository.

Permissions
  `repo#edit`

Parameters

  Path | ID | String | the ID of the CI to rename
  Query | newName | String | the new name.

Response body
  ConfigurationItem - the renamed CI
  Content type: application/xml, application/json

## POST /repository/validate

Validate the configuration items, returning any validation errors found.

Parameters

  Request body | application/xml, application/json | List of ConfigurationItem | The list of configuration items to valdiate.

Response body
  List of ConfigurationItem - The validated configuration items, including any validation messages.
  Content type: application/xml, application/json