# List Activities By Admin — Google Workspace Admin

> Retrieves a report of all Admin console activities done by a specific administrator. See the docs for more information

- Key: `google_workspace-list-activities-by-admin`
- Type: Action (Read-only)
- Version: 0.0.2
- App: Google Workspace Admin (`google_workspace`) — https://pipedream.com/apps/google-workspace.md
- This page (HTML): https://pipedream.com/apps/google-workspace/actions/list-activities-by-admin
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/google_workspace/actions/list-activities-by-admin/list-activities-by-admin.ts

## Description

Retrieves a report of all Admin console activities done by a specific administrator. [See the docs](https://developers.google.com/admin-sdk/reports/v1/guides/manage-audit-admin#get_admin_events) for more information

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `applicationName` | `string` | Yes | Application name for which the events are to be retrieved. |
| `userKey` | `string` | Yes | Represents the profile ID or the user email for which the data should be filtered. Unique Google Workspace profile ID or their primary email address. Must not be a deleted user. For more details on this parameter see the docs here Options are loaded from the connected account. |
| `endTime` | `string` | No | Sets the end of the range of time shown in the report. The date is in the RFC 3339 format, for example 2010-10-28T10:26:35.000Z. The default value is the approximate time of the API request. For more details on this parameter see the docs here |
| `startTime` | `string` | No | Sets the beginning of the range of time shown in the report. The date is in the RFC 3339 format, for example 2010-10-28T10:26:35.000Z. The report returns all activities from Start Time until End Time. The Start Time must be before the End Time (if specified) and the current time when the request is made, or the API returns an error. For more details on this parameter see the docs here |
| `maxResults` | `integer` | No | Determines how many activity records are shown on each response page. For example, if the request sets maxResults=1 and the report has two activities, the report has two pages. The response's nextPageToken property has the token to the second page. The Max Results query string is optional in the request. The default value is 1000. For more details on this parameter see the docs here |
| `filters` | `string` | No | The filters query string is a comma-separated list composed of event parameters manipulated by relational operators. Event parameters are in the form {parameter1 name}{relational operator}{parameter1 value},{parameter2 name}{relational operator}{parameter2 value},..... For more details on this parameter see the docs here |
| `eventName` | `string` | No | The name of the event being queried by the API. Each Event Name is related to a specific Google Workspace service or feature which the API organizes into types of events. An example is the Google Calendar events in the Admin console application's reports. The Calendar Settings type structure has all of the Calendar Event Name activities reported by the API. When an administrator changes a Calendar setting, the API reports this activity in the Calendar Settings type and Event Name parameters. For more information about Event Name query strings and parameters, see the list of event names for various applications above in Application Name. For more details on this parameter see the docs here |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "google_workspace",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "google_workspace-list-activities-by-admin",
  arguments: {
    applicationName: "Application Name",
    userKey: "User Key",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "google_workspace-list-activities-by-admin",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    google_workspace: { authProvisionId: "apn_xxxxxxx" },
    applicationName: "Application Name",
    userKey: "User Key",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "google_workspace-list-activities-by-admin",
    "configured_props": {
      "google_workspace": { "authProvisionId": "apn_xxxxxxx" },
      "applicationName": "Application Name",
      "userKey": "User Key"
    }
  }'
```

---

- App: https://pipedream.com/apps/google-workspace.md · All apps: https://pipedream.com/apps
