Skip to content

Commit b30a1a7

Browse files
authored
JOBSBATCH-224: Updated jobs batch v2 create endpoint examples (#294)
* Updated jobs batch v2 create endpoint examples * Job batches: Updated create job endpoint description
1 parent 505f37e commit b30a1a7

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

spec/job_batches_v2/job_batches_endpoints.yaml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ x-paths:
608608
**Job creation behavior** depends on the `mode` parameter:
609609
610610
- **REUSE_EXISTING**: Returns an existing job if one matches the evaluated name template. If the matching job is
611-
closed or completed, creates a new job with a unique name using the specified `salt` strategy.
611+
cancelled, deleted or closed, creates a new job with a unique name using the specified `salt` strategy.
612612
- **CREATE_NEW**: Attempts to create a new job with the evaluated name. If a job with that name already exists,
613613
appends a unique identifier using the specified `salt` strategy to ensure creation succeeds.
614614
@@ -643,6 +643,48 @@ x-paths:
643643
}
644644
```
645645
Creates: "Feature Release 2025 2025-10-08 02:34:15 PM" (if job already exists)
646+
647+
4. **Job reuse with salt suffix**:
648+
**First request** - Creates initial job:
649+
```json
650+
POST /job-batches-api/v2/projects/abc123/jobs
651+
{
652+
"nameTemplate": "Daily Report {yyyy-MM-dd}",
653+
"mode": "REUSE_EXISTING",
654+
"salt": "RANDOM_ALPHANUMERIC",
655+
"targetLocaleIds": ["fr-FR", "de-DE"]
656+
}
657+
```
658+
Response: `{"jobName": "Daily Report 2025-12-09", "translationJobUid": "job001"}`
659+
660+
**After job is completed and closed...**
661+
662+
**Second request** - Creates job with salt (original is closed):
663+
```json
664+
POST /job-batches-api/v2/projects/abc123/jobs
665+
{
666+
"nameTemplate": "Daily Report {yyyy-MM-dd}",
667+
"mode": "REUSE_EXISTING",
668+
"salt": "RANDOM_ALPHANUMERIC",
669+
"targetLocaleIds": ["fr-FR", "de-DE"]
670+
}
671+
```
672+
Response: `{"jobName": "Daily Report 2025-12-09 a7x9k", "translationJobUid": "job002"}`
673+
674+
**Third request** - Reuses job with salt (prevents duplicate):
675+
```json
676+
POST /job-batches-api/v2/projects/abc123/jobs
677+
{
678+
"nameTemplate": "Daily Report {yyyy-MM-dd}",
679+
"mode": "REUSE_EXISTING",
680+
"salt": "RANDOM_ALPHANUMERIC",
681+
"targetLocaleIds": ["fr-FR", "de-DE"]
682+
}
683+
```
684+
Response: `{"jobName": "Daily Report 2025-12-09 a7x9k", "translationJobUid": "job002"}` (same job)
685+
686+
**Key behavior**: The third request reuses the job with salt suffix instead of creating another duplicate,
687+
preventing multiple jobs with different salts for the same day.
646688
tags:
647689
- Job Batches V2
648690
operationId: createJobV2

0 commit comments

Comments
 (0)