Skip to main content

projects/{pid}/workflows/jobs/new

Create a new workflow (jobs) for existing documents or segments. If you need to upload new files and create workflows for those, please go to: projects/{pid}/workflows/new

NOTE: This method works with Standard projects only. Codyt is NOT supported.

URL

CODE
(POST) /api/projects/{pid}/workflows/jobs/new

PARAMETERS

The URL parameters are:

pid

The project’s ID.

int, Mandatory

The request BODY contains a JSON object with these properties:

mode

Defines the scope of the jobs:

  • Project: This is the default value. The jobs will be for one or more documents (see documentIds).

  • Segments: Specify a filter to select segments and those segments will be assigned to the jobs. There is no need to specify any documents.

  • ProjectAndSegments: Specify both documents and a filter. The jobs will then include the documents but refer to just the filtered segments in those documents.


Note: With Segments you can even pull segments from other projects or translation memories. With ProjectAndSegments, your jobs look very “regular” and the editor will allow preview and other document-centric operations. This option is useful for “split big documents into chunks” scenarios.

string, Optional

documentIds

The documents to include in the jobs. These must be documents from the project. Mandatory if mode is Project or ProjectAndSegments. Optional otherwise.

int[], Optional

segments

Required if mode is Segments or ProjectAndSegments.

object, Optional

segments.scope

Defines the scope of segments to filter. See Scope (Object)

object, Mandatory

segments.query

Defines an optional filter on the segments within the scope. See Search and filter segments for how to construct this object.

object?, Optional

segments.maxSegments

Specify the maximum number of segments that should be selected. By default this is 1000. Jobs with too many segments may not be practical.

int, Optional

trgs

The languages to translate to. These must be valid project languages. Example:

CODE
"trgs": [ "es-ES", "fr-FR" ]

string[], Mandatory

workflowProfileId

An optional workflow profile ID. If null then the method uses the project’s profile (see the “Workflow & Supplier” page in the project).

int, Optional

deadline

Optional deadline for completion of work. Deadlines are assigned to the jobs that are created with the workflow. Example:

CODE
"deadline": "2024-04-03T06:00:00Z"

datetime?, Optional

startDate

Optional earliest start date for jobs. If null then this will be set for immediate start.

datetime?, Optional

startWorkflow

Optional boolean, default is true.

If true, the initial steps (jobs) in the workflow will be started (if assigned) or proposals will be sent out (if supplier groups are assigned in workflow profile).

bool, Optional

Instructions

Optional instructions added to each job. Visible to the workers.

string?, Optional

Comments

Optional internal comments added to each job. Not visible to workers (unless these are internal and have sufficient access rights)

string?, Optional

jobsCfs

Optional custom fields to assign to all jobs created for a file’s workflow. See Custom Field Collection Record for details. Note: You reference a CF by either its “id” or its “title” (name).

Example:

CODE
"jobsCfs": {
    fields": [
      { "title": "Activity", "value": "Fulltime" },
      { "id": 4, "value": "A-221" }    
    ]
}

object[], Optional

callbackurl
callback

Specify a URL which will be called upon success or failure of operation. This makes polling for operation status unnecessary. See Callbacks (with asynchronous operations)

Optional

RESULTS

This method is an asynchronous operation: Your request is queued and will execute as soon as possible.

Asynchronous operations - How to:

The API method immediately returns a JSON object that includes the ID of the operation (look for the requestId property).

However, the operation has not yet been executed. You will need to await the operation’s termination to obtain results.

Waiting can be done in two ways: Polling: Regularly check the operation’s status. Webhook Call: Wait for a callback using the callbackurl parameter in your request. We strongly recommend the latter approach. For more details, please refer to the documentation: Asynchronous operations

The JSON results, obtained with polling or with a callback, include the operation status as well as any results specific to the API method. Below is an example of successful termination:

CODE
 {
    "trm": {
        "requestid": 13432,
        "isbatch": false,
        "status": "Finished",
        "statusText": "Finished!"
    },
    "custom": {
        "jobIds": [ 1000, 1001 ],
        "documentIds": [],
        "request": { ... },
        "segments": {
            "assigned": 48,
            "skipped": 0,
            "failures": 0
        }
    }
}

Check the status of trm/status. In case of success it should say “Finished”.

The node custom/files lists each submitted file with these properties:

  • jobIds: The IDs of the newly created Standard jobs.

  • documentIds: Always empty. Not applicable.

  • request: The original request.

  • segments: If a mode was chosen that assigns segments to jobs, then it includes the amount of segments added:

    • assigned: Total segments that were assigned to the jobs.

    • skipped: Not applicable.

    • failures: Total segments that could not be assigned for technical reasons.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.