projects/{pid}/jobs/bydocuments (post)

Returns, for each requested project document, the jobs the caller is entitled to see. Use this instead of calling jobs/{id}/summary once per job to correlate files with jobs. Works for both Standard and Codyt projects.

URL

(POST) /api/projects/{pid}/jobs/bydocuments

PARAMETERS

URL parameters are:

pid

The project id.

int, Mandatory

REQUEST BODY

The other parameters are included as a JSON object in the request body:

dids

Array of document (file) IDs to look up. 1 to 200 distinct IDs, each ≥ 1. Repeated IDs count once.

array<int>, Mandatory

Example:

JSON
{ "dids": [100, 101, 999] }

RESULTS

A JSON object with these properties:

items

One entry per distinct requested document ID, in the order the IDs were first submitted.

array<object>

Each element of items has:

did

The requested document id.

int

jobs

Jobs on that document visible to the caller. Empty when the caller sees no jobs, when the document belongs to another project, or when the id is unknown: the response never reveals whether a document exists.

array<object>

Each element of jobs has:

jid

The job id, in the same format used by jobs/{id}/summary: s{number} for a Standard job, c{number} for a Codyt job.

string

trg

Target language code of the job. Same field as in jobs/{id}/summary.

string

status

The job status as a number. Standard and Codyt use the same numbers. See Job Status.

int

statust

The job status name. Display text only, do not branch on it.

string

REMARKS

  • All statuses are returned, including completed, cancelled, and not-yet-active steps. Filtering by status is the caller's responsibility, as with jobs/list.

  • Visibility matches jobs/list exactly: only jobs the caller may see are included. A caller with project access but no job rights still gets every requested did, each with an empty jobs array, not an error.

  • With Codyt projects, a workflow creates one job per target language per step, so a single document usually maps to several jobs.

  • A superseded version of a re-uploaded document is an ordinary document id and returns the jobs of that version, as shown in the jobs list.

  • The jobs array has no guaranteed order.

  • The payload is deliberately minimal: no dates, suppliers, costs, progress, or workflow step. Use jobs/list or jobs/{id}/summary for the full job record.

  • Supported callers: project managers, internal users, and suppliers the project has been outsourced to. A supplier who only holds job assignments in a project that was not outsourced to their company cannot use this method, and must continue to use the per-job calls.

ERRORS

Condition

Result

pid is invalid, the project does not exist, or the caller has no access to it

Error: "Project with ID {pid} does not exist or you are not authorized."

Missing JSON body

Error on body: "Missing http json body"

dids missing, empty, more than 200 distinct ids, or any id < 1

Validation error on dids

EXAMPLES

Request:

JSON
{ "dids": [100, 101, 999] }

Response:

JSON
{
  "items": [
    { "did": 100, "jobs": [ { "jid": "c300", "trg": "fr", "status": 6, "statust": "Completed" } ] },
    { "did": 101, "jobs": [] },
    { "did": 999, "jobs": [] }
  ]
}