# ActivitiesResource Resource

### GET /clusters/{clusterName}/services/{serviceName}/activities

Read all activities in the system

Request Parameters
name | type | description | default
--- | --- | --- | ---
clusterName | path | The name of the cluster | n/a
serviceName | path | The name of the service | n/a
maxResults | query | The maximum number of activities to return. | 100

query

query

The query to perform to find activities in the system. By default, this call returns top level (i.e. root) activities that have currently started.

The query specifies the intersection of a list of constraints, joined together with semicolons (without spaces). For example:

status==started;parent==
  looks for running root activities. This is also the default query.
status==failed;finishTime=gt=2012-04-01T20:30:00.000Z
  looks for failed activities after the given date time.
name==Pi Estimator;startTime=gt=2012-04-01T20:30:00.000Z
  looks for activities started after the given date time, with the name of "Pi Estimator".
startTime=lt=2012-01-02T00:00:00.000Z;finishTime=ge=2012-01-01T00:00:00.000Z
  looks for activities that are active on 2012 New Year's Day. Note that they may start before or finish after that day.
status==failed;parent==000014-20120425161321-oozie-joe
  looks for failed child activities of the given parent activity id.
status==started;metrics.cpu_user=gt=10
  looks for started activities that are using more than 10 cores per second.
type==hive;metrics.user==bc;finishTime=gt=2012-04-01T20:30:00.000Z
  looks for all hive queries submitted by user bc after the given date time.

You may query any fields present in the ApiActivity object. You can also query by activity metric values using the metrics.* syntax. Values for date time fields should be ISO8601 timestamps.

The valid comparators are ==, !=, =lt=, =le=, =ge=, and =gt=. They stand for "==", "!=", "<", "<=", ">=", ">" respectively.

status==started;parent==

resultOffset | query | Specified the offset of activities to return. | 0
view | query | The view of the activities to materialize | summary

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiActivityList (JSON) | A list of activities

### GET /clusters/{clusterName}/services/{serviceName}/activities/{activityId}

Returns a specific activity in the system

Request Parameters
name | type | description | default
--- | --- | --- | ---
activityId | path | The id of the activity to retrieve | n/a
clusterName | path | The name of the cluster | n/a
serviceName | path | The name of the service | n/a
view | query | The view of the activity to materialize | summary

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiActivity (JSON) | The Activity object with the specified id

### GET /clusters/{clusterName}/services/{serviceName}/activities/{activityId}/children

Returns the child activities

Request Parameters
name | type | description | default
--- | --- | --- | ---
activityId | path | The id of the activity | n/a
clusterName | path | The name of the cluster | n/a
serviceName | path | The name of the service | n/a
maxResults | query | The maximum number of activities to return. | 100
resultOffset | query | Specified the offset of activities to return. | 0
view | query | The view of the children to materialize | summary

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiActivityList (JSON) | The list of child activities for the specified activity

### GET /clusters/{clusterName}/services/{serviceName}/activities/{activityId}/metrics

Fetch metric readings for a particular activity.

By default, this call will look up all metrics available for the activity. If only specific metrics are desired, use the metrics parameter.

By default, the returned results correspond to a 5 minute window based on the provided end time (which defaults to the current server time). The from and to parameters can be used to control the window being queried. A maximum window of 3 hours is enforced.

When requesting a "full" view, aside from the extended properties of the returned metric data, the collection will also contain information about all metrics available for the activity, even if no readings are available in the requested window.

Request Parameters
name | type | description | default
--- | --- | --- | ---
activityId | path | The name of the activity. | n/a
clusterName | path | The name of the cluster. | n/a
serviceName | path | The name of the service. | n/a
from | query | Start of the period to query. | n/a
metrics | query | Filter for which metrics to query. | n/a
to | query | End of the period to query. | now
view | query | The view of the data to materialize, either "summary" or "full". | summary

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiMetricList (JSON) | List of readings from the monitors.

### GET /clusters/{clusterName}/services/{serviceName}/activities/{activityId}/similar

Returns a list of similar activities

Request Parameters
name | type | description | default
--- | --- | --- | ---
activityId | path | The id of the activity | n/a
clusterName | path | The name of the cluster | n/a
serviceName | path | The name of the service | n/a
view | query | The view of the activities to materialize | summary

Response Body
media type | data type | description
--- | --- | ---
application/json | ApiActivityList (JSON) | The list of similar activities to the specified activity