---
title: "Query Data Jobs details using GraphQL"
method: GET
path: "/data-jobs/for-team/{team_name}/jobs"
tags: ["Data Jobs"]
---

# Query Data Jobs details using GraphQL

`GET /data-jobs/for-team/{team_name}/jobs`

List data Jobs with GraphQL like query. By choosing which field to be returned you can control the output.
You can learn more about the GraphQL queries by visiting [GraphQL official website](https://graphql.org/learn/queries/)
Query should be provided as GET parameter, not by POST body. Don't worry about the spaces and tabs
Keep in mind that each aditional field <b>could make query response time slower, for instance deployments</b>,
it's best if you request only what you need <br/><br/>

The <b>pageNumber</b> and <b>pageSize</b> arguments are required! Page number should be a <b>number greater than 1</b>,
and pageSize <b>should be greater than 1</b> (per page)
Check the latest example for the full list of supported query fields.<br/><br/>

Simplest query that you could make is to fetch the job names
```
{
  jobs(pageNumber: 1, pageSize: 25) {
    content {
      jobName
    }
  }
}
```

You could also use filtering and sorting function. Filter object has <b>property, pattern and sort</b> fields.<br/>
* <b>property</b> points out which field you want to filter, if you point out some other field that is not supported,
an invalid response will be return.<br/>
* <b>pattern</b> should be a non-empty string which the provided property should contains [ignoring cases], for instance: `starshot` pattern will match
<b>import-starshot-sql, StarShot-servers and notify-starshot</b> job names, but it won't match <b>stars-shot-daily-prune`</b>
If a pattern string is not provided, then you must atleast provide the property field<br/>
* <b>sort</b> should be an enum value - ASC (ascending) or DESC (descending) option [not required, default is ASC]
Multiple filters could be applied, but <b>maximum one should contain sorting</b>!
```
{
  jobs(
    pageNumber: 1,
    pageSize: 25,
    filter: [{
      property: "jobName",
      pattern: "starshot",
      sort: DESC
    }],
  ) {
    content {
      jobName
    }
  }
}
```

You could also search for a string into the properties that you are requesting, for instance:
This query will search for job names, team names and descriptions which contains the provided "starshot" string
```
{
  jobs(
    pageNumber: 1,
    pageSize: 25,
    search: "starshot"
  ) {
    content {
      jobName,
      config {
        team
        description
      }
    }
  }
}
```

Data jobs execution could also be searched by providing arguments to the <b>execution</b> field.
Same as parent query arguments, the <b>pageNumber</b> and <b>pageSize</b> arguments are required! Page number should be a <b>number greater than 1</b>,
and pageSize <b>should be between 1 and 100 results</b> (per page). You can also <b>filter</b> using the similar object structure as the parent query,
but currently <b>filtering is not supported</b>, you can only provide field for sorting.
This query will search
```
{
  jobs(
    pageNumber: 1,
    pageSize: 25,
  ) {
    content {
      jobName,
      deployments {
        id
        executions(
          pageNumber: 1,
          pageSize: 5,
          filter: [{
            teamNameIn: ["starshot"]
          }],
          order: {
            property: "startTime",
              direction: DESC
          }
        ) {
          id
          status
          startTime
          endTime
        {
      }
    }
  }
}
```

Full example of currently available for fetching fields. Note that if you combine searching and filtering, first
it will apply filters and then within filtered jobs it will apply the search, vice versa is currently not supported:
```
{
  jobs(
    pageNumber: 1,
    pageSize: 25,
    search: "daily",
    filter: [{
      property: "jobName",
      pattern: "import-sql",
    },{
      property: "team",
      pattern: "starshot",
      sort: DESC
    },{
      property: "deployments.enabled",
      pattern: "enabled",
    }],
  ) {
    content {
      jobName
      config {
        team
        description
        sourceUrl
        schedule {
          scheduleCron
          nextRunEpochSeconds
        }
        contacts {
          notifiedOnJobFailureUserError
          notifiedOnJobFailurePlatformError
          notifiedOnJobSuccess
          notifiedOnJobDeploy
        }
      }
      deployments {
        id
        enabled
        jobVersion
        mode
        executions(
          pageNumber: 1,
          pageSize: 25,
          filter: [{
            teamNameIn: ["starshot"]
          }],
          order: {
            property: "startTime",
              direction: DESC
          }
        ) {
          id
          type
          status
          message
          startTime
          endTime
          opId
          vkdVersion
          jobVersion
          jobSchedule
          resourcesCpuRequest
          resourcesCpuLimit
          resourcesMemoryRequest
          resourcesMemoryLimit
          deployedDate
          deployedBy
          startedBy
          logsUrl
        }
      }
    }
    totalPages
    totalItems
    }
  }
}
```

## Path parameters

- `team_name` string, required

## Query parameters

- `query` string
- `operation_name` string
- `variables` string

## Response `200`

Data Job query response

- DataJobQueryResponse — Query response containing Data Jobs
  - `errors` object[] — Errors while making query (validation errors, exceptions, etc)
  - `data` DataJobPage — Page object containing Data Jobs list with information for total elements and pages
    - `content` object[]
    - `totalItems` integer — Number of elements which meet the given query requirement
    - `totalPages` integer — Number of pages with elements which meet the given query requirement

## Other responses

- `400` — Data Job query response with error

---

[API](https://skmtc.net/vmware/apis/versatile-data-kit-control-service-api.md) · [All operations](https://skmtc.net/vmware/apis/versatile-data-kit-control-service-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/vmware/versatile-data-kit-control-service-api/revisions/6c58be3b5043/schema)
