# Jobs API

Use the Jobs API to retrieve, create, update, and delete job targets or the description.
This REST API lets you interact with:
  
   - <i>M.Target</i> entities, which are targets of a job.
   - The <i>M.JobDescription</i> entity, which contains information about what to do and what is in progress.

{% admonition type="info" name="Note" %} To help you switch to the Jobs API, we provide [guidance on how to update calls in your code](https://doc.sitecore.com/ch/en/developers/cloud-dev/switch-to-the-jobs-api.html). {% /admonition %}

 ## Authentication

 To use the Jobs API, you need:

  - The URL of your Content Hub server. You can get this from your Content Hub Administrator. Enter this URL in the <b>{{server}}</b> variable by hovering your mouse over the variable in the <b>Try it</b> pane and then clicking <b>Edit</b>.
  - An [access token and the client ID](https://doc.sitecore.com/ch/en/developers/cloud-dev/oauth-tokens.html#making-requests). Both are sent with every request. You can create a token through the [Content Hub interface](https://doc.sitecore.com/ch/en/users/content-hub/create-an-oauth-client.html)  or by [requesting one using the API itself](https://doc.sitecore.com/ch/en/developers/cloud-dev/oauth-tokens.html#making-requests).


Version: v2.0
License: closed source
Metadata:
  - product: Content Hub

## Servers

```
https://{server}
```

Variables:
- `server`
Default: "your-server"

## Security

### OAuth2

Type: oauth2

## Download OpenAPI description

[Jobs API](https://api-docs.sitecore.com/_bundle/ch/jobs-api/@v2.0/index.yaml)

## Jobs

The Jobs endpoint is used to retrieve a specific job.  

### Retrieve a job

 - [GET /api/v2/jobs/{id}](https://api-docs.sitecore.com/ch/jobs-api/jobs/jobbyidv2.md): Retrieves a job with a specified ID. Job targets are not retrieved. Only the link to the relation is used. You can get the job ID in the Job details or in the URL when you click a job target on the Processing page (for example, https://contenthub-server.cloud/en-us/user/myjobs/Job/39309 ).

## Job description

The Job description entity contains information for the worker about what needs to be done and what is in progress.

### Retrieve the job description

 - [GET /api/jobs/{id}/description](https://api-docs.sitecore.com/ch/jobs-api/job-description/jobdescription.md): Retrieves the description for a specific job using its ID, for example 39595.

### Create or update the job description

 - [PUT /api/jobs/{id}/description](https://api-docs.sitecore.com/ch/jobs-api/job-description/createorupdatedescription.md): Creates a job description entity if it does not exist or updates the job description entity. It confirms that the job exists and that the user has permission to access it. Properties or relations not included in the request will be set to null.

### Partially update the job description

 - [PATCH /api/jobs/{id}/description](https://api-docs.sitecore.com/ch/jobs-api/job-description/partialupdatedescription.md): Updates part of the job description entity. It confirms that both the job and description exist and that the user has permission to modify them. Properties or relations not included in the request will be set to null.

### Delete the job description

 - [DELETE /api/jobs/{id}/description](https://api-docs.sitecore.com/ch/jobs-api/job-description/deletedescription.md): Deletes the description associated with a job. It confirms that both the job and description exist and that the user has permission to access them.

### Retrieve the job description

 - [GET /api/jobs/{id}/description/{descriptionId}](https://api-docs.sitecore.com/ch/jobs-api/job-description/jobdescriptionbyid.md): Retrieves the description for a specific job using its ID, for example 39595.

## Targets

A target entity is a target of a job (meaning a background process). Each job can have one or more targets.

### Create a job target

 - [POST /api/jobs/{id}/targets](https://api-docs.sitecore.com/ch/jobs-api/targets/createtarget.md): Creates a new target for the specified job and returns the job target ID, for example 39605.

### Retrieve all job targets

 - [GET /api/jobs/{id}/targets](https://api-docs.sitecore.com/ch/jobs-api/targets/jobtargets.md): Lists all the targets associated with a job that match the criteria.

### Create multiple job targets at once

 - [POST /api/jobs/{id}/targets/bulk](https://api-docs.sitecore.com/ch/jobs-api/targets/createtargets.md): Creates new targets for the specified job and returns the job target IDs.

### Retrieve a specific job target

 - [GET /api/jobs/{id}/targets/{targetId}](https://api-docs.sitecore.com/ch/jobs-api/targets/jobtarget.md): Retrieves a job target using the job ID and the target ID.

### Update a job target

 - [PUT /api/jobs/{id}/targets/{targetId}](https://api-docs.sitecore.com/ch/jobs-api/targets/updatetarget.md): Updates a target associated with a job. It ensures that both the job and target exist and that the user has access to them. Properties or relations not included in the request will be set to null.

### Partially update a job target

 - [PATCH /api/jobs/{id}/targets/{targetId}](https://api-docs.sitecore.com/ch/jobs-api/targets/partialupdatetarget.md): Partial update on a target associated with a job. It ensures that the job and target exist and that the user has access to them. The properties and relations included in the request will be updated.

### Delete a job target

 - [DELETE /api/jobs/{id}/targets/{targetId}](https://api-docs.sitecore.com/ch/jobs-api/targets/deletetarget.md): Deletes a target for a job using its ID.

