# Update job

`POST /api/v1/runners/jobs/{jobUUID}/update`

API used by PeerTube runners

Authentication: no security requirement declared for this operation.

Parameters:

- `jobUUID` (path, UUIDv4, uuid, required)
  Type: UUIDv4, uuid
  
  Schema: [UUIDv4](https://sourcey-peertube.pages.dev/api-rest-reference/models/uuidv4.md)
  
  minLength: 36
  
  maxLength: 36
  
  pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
  
  Example:
  
  ```json
  "9c9de5e8-0a1e-484a-b099-e80766180a6d"
  ```

Request body: application/json

Type: object

- `runnerToken` (required)
  Type: string

- `jobToken` (required)
  Type: string

- `progress` (optional)
  Type: integer
  
  Update job progression percentage (optional)

- `payload` (optional)
  Type: object
  
  anyOf:
    Type: object
    
    Provide live transcoding chunks update
    
    - `type` (optional)
      Type: string
      
      enum: ["add-chunk","remove-chunk"]
    
    - `masterPlaylistFile` (optional)
      Type: string, binary
    
    - `resolutionPlaylistFile` (optional)
      Type: string, binary
    
    - `resolutionPlaylistFilename` (optional)
      Type: string
    
    - `videoChunkFile` (optional)
      Type: string, binary
    
    - `videoChunkFilename` (optional)
      Type: string

Responses:

- 204: successful operation

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/update' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "runnerToken": "string",
  "jobToken": "string",
  "progress": 0,
  "payload": {
    "type": "add-chunk",
    "masterPlaylistFile": "<binary>",
    "resolutionPlaylistFile": "<binary>",
    "resolutionPlaylistFilename": "string",
    "videoChunkFile": "<binary>",
    "videoChunkFilename": "string"
  }
}'
```

### JavaScript

```javascript
const body = `{
  "runnerToken": "string",
  "jobToken": "string",
  "progress": 0,
  "payload": {
    "type": "add-chunk",
    "masterPlaylistFile": "<binary>",
    "resolutionPlaylistFile": "<binary>",
    "resolutionPlaylistFilename": "string",
    "videoChunkFile": "<binary>",
    "videoChunkFilename": "string"
  }
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/update', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "runnerToken": "string",
  "jobToken": "string",
  "progress": 0,
  "payload": {
    "type": "add-chunk",
    "masterPlaylistFile": "<binary>",
    "resolutionPlaylistFile": "<binary>",
    "resolutionPlaylistFilename": "string",
    "videoChunkFile": "<binary>",
    "videoChunkFilename": "string"
  }
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/runners/jobs/9c9de5e8-0a1e-484a-b099-e80766180a6d/update',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
