# humanresources.hcmlink.job.update

URL: https://chugunov.pro/api-bitrix24/sign/hcm-link/humanresources-hcmlink-job-update/
Проверено на Битрикс24 REST API, обновлено 11.09.2026 (ревизия источника fb39d6c).
Источник: официальная документация Битрикс24 (bitrix-tools/b24-rest-docs, лицензия MIT, © Bitrix). Справочник независимый, официальной документацией не является.

Обновить задание HCM Link
Scope: `humanresources.hcmlink`
Кто может выполнять метод: администратор

## Описание

Метод `humanresources.hcmlink.job.update` обновляет задание синхронизации HCM Link.

Метод работает только в контексте авторизации [приложения](https://apidocs.bitrix24.ru/settings/app-installation/index.html).

## Параметры

- `id` `integer` — обязательный. Идентификатор задания синхронизации.
  Идентификатор приходит в поле `jobId` событий `OnHumanResourcesHcmLinkEmployeeListRequested`, `OnHumanResourcesHcmLinkFieldValueRequested`, `OnHumanResourcesHcmLinkEmployeeListMapped`, `OnHumanResourcesHcmLinkPinRequested` или `OnHumanResourcesHcmLinkSalaryVacationRequested`
- `fields` `object` — обязательный. Данные задания [(подробное описание)](#fields)

### Параметр fields

- `status` `string` — обязательный. Новый статус задания.
  Возможные значения:
  - `IN_PROGRESS` — выполняется
  - `DONE` — выполнено
  - `CANCELED` — отменено
- `total` `integer` — необязательный. Общее количество элементов в задании
- `sent` `integer` — необязательный. Количество обработанных элементов
- `data` `object` — необязательный. Дополнительные данные задания

## Ответ

HTTP-статус: 200

```json
{
    "result": true,
    "time": {
        "start": 1739860000.123,
        "finish": 1739860000.456,
        "duration": 0.333,
        "processing": 0.111,
        "date_start": "2026-08-06T19:51:02+03:00",
        "date_finish": "2026-08-06T19:51:02+03:00"
    }
}
```

### Возвращаемые данные

- `result` `boolean`. Возвращает `true`, если задание обновлено
- `time` `time`. Информация о времени выполнения запроса

## Ошибки

HTTP-статус: 200

```json
{
    "result": {
        "error": 0,
        "error_description": "Operation failed"
    }
}
```

- `0` — Operation failed. Задание не найдено или передан неактуальный статус
- `ACCESS_DENIED` — Access denied! Access denied.. Пользователь не является администратором
- `WRONG_AUTH_TYPE` — Application context required. Метод вызван не в контексте приложения

## Примеры запроса

### cURL (OAuth)

```bash
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"id":101,"fields":{"status":"DONE","total":10,"sent":10,"data":{"batch":"2026-08-06"}},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/humanresources.hcmlink.job.update
```

### JS (TS)

```ts
import { Text } from '@bitrix24/b24jssdk'
import type { B24Frame } from '@bitrix24/b24jssdk'

declare const $b24: B24Frame

try {
  const response = await $b24.actions.v2.call.make({
    method: 'humanresources.hcmlink.job.update',
    params: {
      id: 101,
      fields: {
        status: 'DONE',
        total: 10,
        sent: 10,
        data: {
          batch: '2026-08-06',
        },
      },
    },
    requestId: Text.getUuidRfc4122()
  })

  if (!response.isSuccess) {
    console.error(response.getErrorMessages().join('; '))
  } else {
    console.info(response.getData()!.result)
  }
} catch (error) {
  console.error(error)
}
```

### JS (UMD)

```html
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
  async function updateHcmLinkJob() {
    try {
      const $b24 = await B24Js.initializeB24Frame()

      const response = await $b24.actions.v2.call.make({
        method: 'humanresources.hcmlink.job.update',
        params: {
          id: 101,
          fields: {
            status: 'DONE',
            total: 10,
            sent: 10,
            data: {
              batch: '2026-08-06'
            }
          }
        },
        requestId: B24Js.Text.getUuidRfc4122()
      })

      if (!response.isSuccess) {
        console.error(response.getErrorMessages().join('; '))
        return
      }

      console.info(response.getData().result)
    } catch (error) {
      console.error(error)
    }
  }

  document.addEventListener('DOMContentLoaded', updateHcmLinkJob)
</script>
```

### PHP

```php
try {
    $response = $b24Service
        ->core
        ->call(
            'humanresources.hcmlink.job.update',
            [
                'id' => 101,
                'fields' => [
                    'status' => 'DONE',
                    'total' => 10,
                    'sent' => 10,
                    'data' => [
                        'batch' => '2026-08-06',
                    ],
                ],
            ]
        );

    $result = $response
        ->getResponseData()
        ->getResult();

    echo 'Success: ' . print_r($result, true);
} catch (Throwable $e) {
    error_log($e->getMessage());
    echo 'Error updating job: ' . $e->getMessage();
}
```

### BX24.js

```js
BX24.callMethod(
    'humanresources.hcmlink.job.update',
    { id: 101, fields: { status: 'DONE', total: 10, sent: 10, data: { batch: '2026-08-06' } } },
    function(result)
    {
        if (result.error())
        {
            console.error(result.error(), result.error_description());
        }
        else
        {
            console.dir(result.data());
        }
    }
);
```

### PHP CRest

```php
require_once('crest.php');

$result = CRest::call(
    'humanresources.hcmlink.job.update',
    [
        'id' => 101,
        'fields' => [
            'status' => 'DONE',
            'total' => 10,
            'sent' => 10,
            'data' => [
                'batch' => '2026-08-06',
            ],
        ],
    ]
);

echo '<PRE>';
print_r($result);
echo '</PRE>';
```

### Go

```go
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "humanresources.hcmlink.job.update", b24.Params{
	"id": 101,
	"fields": b24.Params{
		"status": "DONE",
		"total":  10,
		"sent":   10,
		"data": b24.Params{
			"batch": "2026-08-06",
		},
	},
}, b24.WithIdempotent())
if err != nil {
	return fmt.Errorf("humanresources.hcmlink.job.update: %w", err)
}

var updated bool
if err := json.Unmarshal(res.Result, &updated); err != nil {
	return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(updated)
```

Оригинал в официальной документации: https://apidocs.bitrix24.ru/api-reference/sign/hcm-link/humanresources-hcmlink-job-update.html
