Skip to content

Chaya's REST V2 Usage

Chaya Malik edited this page Nov 24, 2020 · 15 revisions

Task Annotations

Task Annotations give users more context about task failures.

Objects

Host
Name Type Description
task_id string Identifier of the task that this annotation is for
task_execution int The number of the execution of the task that the annotation is for
metadata map[string]interface{} Structured data about the task. Since this is user-given json data, the structure can differ between annotations
note note_object Comment about the task failure
issues []issue_link Links to tickets definitely related
suspected_issues []issue_link Links to tickets possibly related
Note
Name Type Description
message string Comment about the task failure
source source_object The source of the note
Source
Name Type Description
author string The author of the edit
time time The time of the edit
requester string The source of the request, either an api or a user
Issue Link
Name Type Description
url string The url of the ticket
issue_key string Text to be displayed
source source_object The source of the edit

Endpoints

Fetch All Hosts

GET /hosts

Returns a paginated list of all hosts in Evergreen

Parameters
Name Type Description
start_at string Optional. The identifier of the host to start at in the pagination
limit int Optional. The number of hosts to be returned per page of pagination. Defaults to 100
status string Optional. A status of host to limit the results to

Fetch Hosts Spawned By User

GET /users/<user_id>/hosts

Returns a list of hosts spawned by the given user.

Parameters
Name Type Description
start_at string Optional. The identifier of the host to start at in the pagination
limit int Optional. The number of hosts to be returned per page of pagination. Defaults to 100
status string Optional. A status of host to limit the results to

Fetch Host By ID

GET /hosts/<host_id>

Fetches a single host using its ID

Spawn a Host

POST /hosts

Spawns a host. The host must be of a distro which is spawnable by users (see `Distro`_).

Parameters
Name Type Description
distro string `Distro`_ name to spawn
keyname string `Key`_ name to use

Terminate Host with Given Host ID

POST /hosts/<host_id>/terminate

Immediately terminate a single host with given ID. Users may only terminate hosts which were created by them, unless the user is a super-user.

Hosts which have not been initialised yet will be marked as Terminated.

Trying to terminate a host which has already been terminated will result in an error.

All other host statuses will result in an attempt to terminate using the provider's API

A response code of 200 OK indicates that the host was successfully terminated

All other response codes indicate errors; the response body can be parsed as a rest.APIError

Change RDP Password of Host with Given Host ID

POST /hosts/<host_id>/change_password

Immediately changes the RDP password of a Windows host with a given ID. Users may only change passwords for hosts which were created by them, unless the user is a super-user.

A response code of 200 OK indicates that the host's password was successfully terminated

Attempting to set the RDP password of a host that is not a Windows host or host that is not running will result in an error.

All other response codes indicate errors; the response body can be parsed as a rest.APIError

Change Password
Name Type Description
rdp_pwd string New RDP password; must meet RDP password criteria as provided by Microsoft at: https://technet.microsoft.com/en-us/library/cc786468(v=ws.10).aspx and be between 6 and 255 characters long

Extend the Expiration of Host with Given Host ID

POST /hosts/<host_id>/extend_expiration

Extend the expiration time of a host with a given ID. Users may only extend expirations for hosts which were created by them, unless the user is a super-user

The expiration date of a host may not be more than 1 week in the future.

A response code of 200 OK indicates that the host's expiration was successfully extended.

Attempt to extend the expiration time of a terminated host will result in an error

All other response codes indicate errors; the response body can be parsed as a rest.APIError

Extend Expiration
Name Type Description
add_hours int Number of hours to extend expiration; not to exceed 168
Clone this wiki locally