Job API v6

From Memsource
Jump to: navigation, search

Create New Job

action: api/v6/job/create
    token                                                string
    project                                              domain(Project)
    file                                                 file
    path                                                 string                   O         // destination directory 
    targetLang                                           list(locale)
    due                                                  datetime                 O
    linguist                                             domain(User)             O
    segmentationRule                                     domain(SegRule)          O
    tableOfContents                                      boolean                  O(false)
    notes                                                boolean                  O(false)
    masterSlides                                         boolean                  O(false)
    idmlExtractNotes                                     boolean                  O(false)
    idmlSimplifyCodes                                    boolean                  O(true)
    idmlExtractMasterSpreads                             boolean                  O(true)
    idmlExtractLockedLayers                              boolean                  O(true)
    idmlExtractInvisibleLayers                           boolean                  O(false)
    idmlKeepKerning                                      boolean                  O(false)
    idmlKeepTracking                                     boolean                  O(false)
    idmlTargetFont                                       string                   O
    idmlReplaceFont                                      boolean                  O(true)
    mifExtractBodyPages                                  boolean                  O(true)
    mifExtractReferencePages                             boolean                  O(false)
    mifExtractMasterPages                                boolean                  O(true)
    mifExtractHiddenPages                                boolean                  O(false)
    mifExtractVariables                                  boolean                  O(false)
    mifExtractIndexMarkers                               boolean                  O(true)
    mifExtractLinks                                      boolean                  O(false)
    mifExtractXRefDef                                    boolean                  O(false)
    mifExtractPgfNumFormat                               boolean                  O(true)
    mifExtractCustomReferencePages                       boolean                  O(true)
    mifExtractDefaultReferencePages                      boolean                  O(false)
    mifExtractUsedVariables                              boolean                  O(true)
    mifExtractHiddenCondText                             boolean                  O(false)
    mifExtractUsedXRefDef                                boolean                  O(true)
    mifExtractUsedPgfNumFormat                           boolean                  O(true)
    xlsSheetNames                                        boolean                  O(false)
    xlsHidden                                            boolean                  O(false)
    xlsComments                                          boolean                  O(false)
    xlsOther                                             boolean                  O(false)
    xlsCellFlow                                          enum(XlsCellFlow)        O(DownRight)
    xlsProcessHtml                                       boolean                  O(false)
    xlsTagRegexp                                         string                   O
    bilingualXlsSourceColumn                             string                   O
    bilingualXlsTargetColumn                             string                   O
    bilingualXlsContextColumn                            string                   O
    bilingualXlsMaxLenColumn                             string                   O
    bilingualXlsTagRegexp                                string                   O
    bilingualXlsProcessHtml                              boolean                  O(false)
    bilingualXlsSegmentation                             boolean                  O(true)
    docComments                                          boolean                  O(false)
    docIndex                                             boolean                  O(true)
    docOther                                             boolean                  O(false)
    docTagRegexp                                         string                   O
    docHyperlinkTarget                                   boolean                  O(false)
    docJoinSimilarRuns                                   boolean                  O(false)
    docTargetFont                                        string                   O
    docProperties                                        boolean                  O(false)
    docJoinSimilarRuns                                   boolean                  O(false)
    pptHiddenSlides                                      boolean                  O(false)
    pptOther                                             boolean                  O(false)
    jsonCodeFinderRegexp                                 string                   O
    jsonHtmlSubFilter                                    boolean                  O(true)
    jsonIncludeKeyRegexp                                 string                   O
    jsonContextPath                                      string                   O
    xmlRulesFormat                                       enum(XmlRulesFormat)     O(PLAIN)
    xmlIncludeTags                                       string                   O(*)       //Elements (import selected), example: "para,heading", only PLAIN format
    xmlExcludeTags                                       string                   O       // Elements (ignore selected), example: "script,object", only PLAIN format
    xmlIncludeAttributes                                 string                   O       // Attributes (import selected), example: "title", only PLAIN format
    xmlExcludeAttributes                                 string                   O       // Attributes (ignore selected), example: "lang,href", only PLAIN format
    xmlInlineTags                                        string                   O       // Translatable inline elements, example: "tt,b", only PLAIN format
    xmlInlineTagsNonTranslatable                         string                   O       //Non-translatable inline elements,  example: "tt,b", only PLAIN format
    xmlInlineTagsAuto                                    boolean                  O(false)       // Identify inline elements automatically, only PLAIN format
    xmlSubFilterTags                                     string                   O       // HTML subfilter; example: "tt,b", only PLAIN format
    xmlEntities                                          boolean                  O(false)       // Convert to character entities
    xmlLockTags                                          string                   O       // Locked elements, example: "para,heading", only PLAIN format
    xmlLockAttributes                                    string                   O       // Locked attributes, example: "title", only PLAIN format
    xmlIncludeXPath                                      string                   O       // only used for XPATH format
    xmlInlineTagsXPath                                   string                   O       // only used for XPATH format
    xmlInlineTagsNonTranslatableXPath                    string                   O       // only used for XPATH format
    xmlInlineTagsAutoXPath                               boolean                  O(false)
    xmlSubFilterTagsXPath                                string                   O                  //HTML subfilter; only used for XPATH format
    xmlLockXPath                                         string                   O                  // only used for XPATH format
    xmlSegmentation                                      boolean                  O(true)
    xmlTagRegexp                                         string                   O
    xmlContextXPath                                      string                   O
    xmlMaxLenXPath                                       string                   O
    xmlPreserveWhitespaceXPath                           string                   O
    xmlPreserveCharEntities                              string                   O
    bilingualXmlTranslatableElementsXPath                string                   O
    bilingualXmlSourceElementsXPath                      string                   O
    bilingualXmlTargetElementsXPath                      string                   O
    bilingualXmlInlineElementsNonTranslatableXPath       string                   O
    bilingualXmlTagRegexp                                string                   O
    bilingualXmlSegmentation                             boolean                  O(true)
    htmlBreakTagCreatesSegment                           boolean                  O(true)
    htmlUnknownTagCreatesTag                             boolean                  O(true)
    htmlPreserveWhitespace                               boolean                  O(false)
    htmlExcludeElements                                  string                   O                  // example: "script,blockquote"
    htmlTagRegexp                                        string                   O
    htmlCharEntitiesToTags                               string                   O
    xlfImportNotes                                       boolean                  O(true)
    xlfSegmentation                                      boolean                  O(true)
    xlfSkipImportRules                                   string                   O(translate=no)    // example: "translate=yes,approved=no,state=needs-adaptation"
    xlfImportAsConfirmedRules                            string                   O                  //          multiples rules must be separated by newline or semicolon
    xlfImportAsLockedRules                               string                   O                
    xlfExportAttrsWhenConfirmedAndLocked                 string                   O                
    xlfExportAttrsWhenConfirmedAndNotLocked              string                   O
    xlfExportAttrsWhenNotConfirmedAndLocked              string                   O
    xlfExportAttrsWhenNotConfirmedAndNotLocked           string                   O
    xlfSaveConfirmedSegments                             boolean                  O(true)
    xlfLineBreakTags                                     string                   O
    xlfPreserveWhitespace                                boolean                  O(true)
    xlfContextType                                       string                   O
    xlfCopySourceToTargetIfNotImported                   boolean                  O(true)
    sdlXlfSkipImportRules                                string                   O(translate=no)    // example: "translate=yes,locked=true,state=Draft"
    sdlXlfImportAsConfirmedRules                         string                   O                  //          multiples rules must be separated by newline or semicolon
    sdlXlfImportAsLockedRules                            string                   O(locked=true)
    sdlXlfExportAttrsWhenConfirmedAndLocked              string                   O(locked=true)
    sdlXlfExportAttrsWhenConfirmedAndNotLocked           string                   O
    sdlXlfExportAttrsWhenNotConfirmedAndLocked           string                   O(locked=true)
    sdlXlfExportAttrsWhenNotConfirmedAndNotLocked        string                   O
    sdlXlfSaveConfirmedSegments                          boolean                  O(true)
    ttxSaveConfirmedSegments                             boolean                  O(true)
    csvDelimiter                                         string                   O(,)
    csvDelimiterType                                     enum(CsvDelimiter)       O(COMMA)
    csvHtmlSubFilter                                     boolean                  O(false)
    csvTagRegexp                                         string                   O
    csvImportColumns                                     string                   O
    csvContextColumn                                     string                   O
    csvMaxLenColumn                                      string                   O
    yamlHtmlSubFilter                                    string                   O
    yamlTagRegexp                                        string                   O
    yamlIncludeKeyRegexp                                 string                   O
    yamlContextPath                                      string                   O
    ditaIncludeTags                                      string                   O
    ditaExcludeTags                                      string                   O
    ditaInlineTags                                       string                   O
    ditaInlineTagsNonTranslatable                        string                   O
    docBookIncludeTags                                   string                   O
    docBookExcludeTags                                   string                   O
    docBookInlineTags                                    string                   O
    docBookInlineTagsNonTranslatable                     string                   O
    poTagRegexp                                          string                   O
    poExportMultiline                                    boolean                  O(true)
    macStringsHtmlSubfilter                              boolean                  O(false)
    macStringsTagRegexp                                  string                   O
    txtTagRegexp                                         string                   O
    propertiesTagRegexp                                  string                   O     
    inputCharset                                         charset                  O
    outputCharset                                        charset                  O
    zipCharset                                           charset                  O
    fileFormat                                           string                   O
    targetLength                                         boolean                  O(false)
    targetLengthMax                                      integer                  O(1000)
    targetLengthPercent                                  boolean                  O(false)
    targetLengthPercentValue                             double                   O(130)

response: JSON
    {
      "unsupportedFiles": [ "document.pdf" ],
      "jobParts" : [
        {
          "id": 9371,
          "task": "5023cd08e4b015e0656c4a8f",
          "fileName": "document.txt",
          "targetLang": "de",
          "wordCount":121,
          "beginIndex":0,
          "endIndex":14
        },
        {
          "id": 9372,
          "task": "5087ab08eac015e0656c4a00",
          "fileName": "document.doc",
          "targetLang": "de",
          "wordCount": 121,
          "beginIndex":0,
          "endIndex":14
        }
      ]
    }

error codes
    JobCreateError

Edit Job

action: api/v6/job/edit
    token                       string
    jobPart                     domain(JobPart)
    due                         datetime                 O N
    linguist                    domain(User)             O N           // mutually exclusive with "vendor" parameter
    vendor                      domain(Vendor)           O N           // mutually exclusive with "linguist" parameter
    status                      enum(JobStatus)          O

response: empty

Delete Job

action: api/v6/job/delete
    token                       string
    jobPart                     domain(JobPart)
    purge                       boolean            O(false)

response: empty

Get Job

action: api/v6/job/get
    token                       string
    jobPart                     domain(JobPart)

response: JSON
    {
      "id":1,
      "internalId":"1",
      "task":"Fsg0ETx1y6FAR8Tl1",
      "fileName":"small.properties",
      "targetLang":"de",
      "workflowLevel":1,
      "status":"COMPLETED",
      "isParentJobSplit":false,
      "assignedTo":{
        "active":true,
        "deleted":false,
        "email":"test@test.com",
        "firstName":"linguist",
        "id":2,
        "lastName":"test",
        "role":"LINGUIST",
        "userName":"linguist"
      },
      "dateDue":null,
      "dateCreated":"2015-08-25T15:44:36Z",
      "project":{
        "id":1,
        "internalId":1,
        "name":"project",
        "status":"NEW",
        "sourceLang":"en",
        "targetLangs":[
          "cs",
          "de"
        ],
        "dateDue":null,
        "dateCreated":"2015-08-25T15:44:35Z",
        "note":null,
        "machineTranslateSettings":null,
        "workflowSteps":[
    
        ],
        "client":null,
        "domain":null,
        "subDomain":null,
        "langSettings":[
    
        ],
        "createdBy":{
          "active":true,
          "deleted":false,
          "email":"test@test.com",
          "firstName":"admin",
          "id":1,
          "lastName":"test",
          "role":"ADMIN",
          "userName":"admin"
        }
      },
      "job":{
        "importResult":{
          "warning":null
        }
      },
      "wordsCount":3,
      "beginIndex":0,
      "endIndex":2,
      "workflowStep":null,
      "readOnly":false,
      "lastModified":{
        "date":"2015-08-25T15:44:38Z",
        "by":{
          "active":true,
          "deleted":false,
          "email":"test@test.com",
          "firstName":"admin",
          "id":1,
          "lastName":"test",
          "role":"ADMIN",
          "userName":"admin"
        }
      },
      "segmentsLastModified":{
        "date":"2015-08-25T15:44:38Z",
        "by":{
          "active":true,
          "deleted":false,
          "email":"test@test.com",
          "firstName":"admin",
          "id":1,
          "lastName":"test",
          "role":"ADMIN",
          "userName":"admin"
        },
        "action":"UPLOAD_BILINGUAL"
      }
    }

List Jobs

action: api/v6/job/list
    token                       string
    jobPart                     list(domain(JobPart))

response: JSON
    [
      {
        "id": 9372,
        "task": "5087ab08eac015e0656c4a00",
        "fileName": "my.doc",
        "targetLang": "en",
        "workflowLevel": 1,
        "status": "NEW",
        "isParentJobSplit": false,
        "wordsCount": 331,
        "beginIndex":0,
        "endIndex":14,
        "assignedTo": {
          "id": 501,
          "userName": "admin",
          "email": "support@memsource.com"
        }
        // ... see Get Job
      }
    ]

List Jobs By Task

action: api/v6/job/listByTask
    token                       string
    task                        task
    workflowLevel               integer         O(1)

response: JSON
    [
      {
        "id": 9372,
        "task": "5087ab08eac015e0656c4a00",
        "fileName": "my.doc",
        "targetLang": "en",
        "workflowLevel": 1,
        "status": "NEW",
        "isParentJobSplit": false,
        "wordsCount": 331,
        "beginIndex":0,
        "endIndex":14,
        "assignedTo": {
          "id": 501,
          "userName": "admin",
          "email": "support@memsource.com"
        }
      }
      // ... see Get Job
   ]

Get Original File

By Job Part

action: api/v6/job/getOriginalFile
    token                       string
    jobPart                     domain(JobPart)

response: binary

response headers
    Content-Disposition         file name
    X-Memsource                 json
        {
          "fileName": "agreement.doc"
        }

By Task

action: api/v6/job/getOriginalFileByTask
    token                       string
    task                        task

response: binary

response headers
    Content-Disposition         file name
    X-Memsource                 json
        {
          "fileName": "agreement.doc"
        }

Get Bilingual File

action: api/v6/job/getBilingualFile
    token                       string
    jobPart                     list(domain(JobPart))
    format                      enum(BilingualFormat)    O(Mxlf)

response: binary

response headers
    Content-Disposition         file name

Get Preview File

action: api/v6/job/getPreviewFile
    token                       string
    bilingualFile               file
    task                        task

response: binary

response headers
    Content-Disposition         file name
    X-Memsource                 json
        {
          "fileName": "agreement-en-de-C.doc"
        }

Get Completed File

action: api/v6/job/getCompletedFile
    token                       string
    jobPart                     domain(JobPart)

response: binary

response headers
    Content-Disposition         file name
    X-Memsource                 json
        {
          "fileName": "agreement-en-de-C.doc"
        }

Get Completed File By Task

action: api/v6/job/getCompletedFileByTask
    token                       string
    task                        task
    workflowLevel               integer              O(1)
    format                      enum(PreviewFormat)  O(ORIGINAL)

response: binary

response headers
    Content-Disposition         file name
    X-Memsource                 json
        {
          "fileName": "agreement-en-de-C.doc"
        }

Upload Bilingual File

action: api/v6/job/uploadBilingualFile
    token                       string
    bilingualFile               file
    format                      enum(BilingualFormat)    O(Mxlf)
    saveToTransMemory           enum(TransMemSave)       O(Confirmed)
    setCompleted                boolean                  O(false)

response: JSON
    [
      {
        "id": 9372,
        "task": "5087ab08eac015e0656c4a00",
        "fileName": "my.doc",
        "targetLang": "en",
        "workflowLevel": 1,
        "status": "NEW",
        "isParentJobSplit": false,
        "wordsCount": 331,
        "beginIndex":0,
        "endIndex":14,
        "assignedTo": {
          "id": 501,
          "userName": "admin",
          "email": "support@memsource.com"
        }
      }
    ]

Convert Bilingual File

action: api/v6/job/convertBilingualFile
    token                       string
    bilingualFile               file
    from                        enum(BilingualFormat)
    to                          enum(BilingualFormat)

response: binary

Machine Translation

action: api/v6/job/machineTranslate
    token                       string
    task                        task
    text                        list(string)

response: JSON
    {
      "translations": [ "Hallo", "Welt" ]
    }

error codes
    MachineTranslateNotSelected

Get Translation Resources

action: api/v6/job/getTranslationResources
    token                       string
    task                        task
    workflowLevel               integer         O(1)

response: JSON
   {
     "termBases":[
       {
         "termBase":{
           "id":1,
           "name":"termBase",
           "langs":[
             "de",
             "en"
           ]
         },
         "writeMode":true,
         "targetLang":"de",
         "readMode":true,
         "workflowStep":null
       }
     ],
     "transMemories":[
       {
         "writeMode":true,
         "transMemory":{
           "id":1,
           "targetLangs":[
             "de"
           ],
           "sourceLang":"en",
           "name":"transMem"
         },
         "targetLang":"de",
         "penalty":0,
         "readMode":true,
         "workflowStep":null
       }
     ],
     "targetLang":"de",
     "fileName":"small.properties",
     "machineTranslator":{
       "name":"Google",
       "type":"GoogleTranslate"    // see MachineTranslator enum for all possible values
     },
     "access":{
       "showUserDataToLinguists": true,
       "downloadEnabled": true
     }
   }

Set Status

action: api/v6/job/setStatus
    token                       string
    jobPart                     domain(JobPart)
    status                      enum(JobStatus)

response: empty

Get Segments Count ("Get Progress")

action: api/v6/job/getSegmentsCount
    token                       string
    jobPart                     list(domain(JobPart))        M(100)

response: JSON
   [
     {
       "counts":{
         "allConfirmed":false,
         "charsCount":923,
         "confirmedCharsCount":0,
         "lockedSegmentsCount":0,
         "qualityAssurance":{
           "ignoredWarningsCount":0,
           "segmentsCount":0,
           "warningsCount":0
         },
         "qualityAssuranceResolved":false,
         "segmentGroupsCount":10,
         "segmentsCount":10,
         "translatedLockedSegmentsCount":0,
         "translatedSegmentsCount":0
       }
     }
   ]

Get Segments

action: api/v6/job/getSegments
    token                       string
    task                        task
    beginIndex                  int
    endIndex                    int

response: JSON
   [
     [
       {
         "createdAt":1349958069141,
         "createdBy":{
           "firstName":"administrator",
           "id":30,
           "lastName":"admin",
           "userName":"admin"
         },
         "id":"1wHy5zBpxBsb1omg1:0",
         "modifiedAt":0,
         "modifiedBy":null,
         "source":"Hello",
         "translation":"Hallo",
         "workflowStep":{
           "abbr":"P",
           "id":4,
           "level":1,
           "name":"Preparation"
         }
       },
       {
         "createdAt":1349958069141,
         "createdBy":{
           "firstName":"administrator",
           "id":30,
           "lastName":"admin",
           "userName":"admin"
         },
         "id":"1wHy5zBpxBsb1omg1:0",
         "modifiedAt":0,
         "modifiedBy":null,
         "source":"Hello",
         "translation":"Hallo",
         "workflowStep":{
           "abbr":"T",  
           "id":1,
           "level":2,
           "name":"Translation"
         }
       }
     ]
   ]

Get Workflow Steps

action: api/v6/job/getWorkflowSteps
    token                       string
    task                        task

response: JSON
   [
     {
       "id":1,
       "level":1,
       "name":"Translation",
       "abbr":"T"
     },
     {
       "id":2,
       "level":2,
       "name":"Revision",
       "abbr":"R"
     }
   ]

Compare Bilingual File

action: api/v6/job/compareBilingualFile
    token                       string
    bilingualFile               file
    compareToLevel              int

response: JSON
   [
     {
       "segmentId":"MF5qobgaMiKFA8ak:0",
       "state":"Diff",
     },
     {
       "segmentId":"MF5qobgaMiKFA8ak:1",
       "state":"Miss",
     }
   ]

Compare Workflow Steps

action: api/v6/job/compareWorkflowSteps
    token                       string
    jobPart                     list(domain(JobPart))
    compareAtLevel              int
    compareWithLevel            int

response: JSON
   [
     {
       "segmentId":"MF5qobgaMiKFA8ak:0",
       "state":"Diff",
     },
     {
       "segmentId":"MF5qobgaMiKFA8ak:1",
       "state":"Miss",
     }
   ]

List By Project

action: api/v6/job/listByProject
    token                       string
    page                        integer                      O(0)
    project                     domain(Project)
    workflowLevel               integer                      O(1)
    assignedTo                  domain(User)                 O
    status                      enum(JobFilter.Status)       O

response: JSON
   [
     {
       "id":1,
       "project":{
         "targetLangs":[
           "cs",
           "de"
         ],
         "client":null,
         "status":"NEW",
         "subDomain":null,
         "sourceLang":"en",
         "dateDue":null,
         "workflowSteps":[],
         "id":1,
         "name":"project",
         "machineTranslateSettings":null,
         "domain":null,
         "dateCreated":"2013-10-31T10:15:05Z",
         "note":null
       },
       "status":"NEW",
       "targetLang":"de",
       "task":"U8llA7UOMiKGJ8Dk",
       "assignedTo":{
         "id":2,
         "lastName":"test",
         "email":"test@test.com",
         "userName":"linguist",
         "role":"LINGUIST",
         "active":true,
         "firstName":"linguist"
       },
       "fileName":"small.properties",
       "dateCreated":"2013-10-31T10:15:06Z",
       "dateDue":null,
       "workflowLevel":1,
       "isParentJobSplit":false,
       "wordsCount": 331,
       "beginIndex":0,
       "endIndex":14
     }
   ]

Pre-translate

action: api/v6/job/preTranslate
    token                               string
    jobPart                             list(domain(JobPart))
    useTranslationMemory                boolean                    O(true)
    translationMemoryThreshold          double                     O(0.7)
    useMachineTranslation               boolean                    O(true)
    insertMachineTranslationIntoTarget  boolean                    O(true)
    preTranslateNonTranslatables        boolean                    O(false)
    confirm100Matches                   boolean                    O(false)
    confirm101Matches                   boolean                    O(false)
    lock101Matches                      boolean                    O(false)
    lock100Matches                      boolean                    O(false)
    overwrite                           boolean                    O(false)
    segmentFilter                       list(enum(SegmentFilter))  O

response: empty

Pseudo-translate

action: api/v6/job/pseudoTranslate
    token                               string
    jobPart                             list(domain(JobPart))
    replacement                         string                     O($)
    prefix                              string                     O(aaa)
    suffix                              string                     O(bbb)
    length                              double                     O(1)

response: empty

Notify Assigned Linguist

action: api/v6/job/notifyAssignedLinguist
    token                               string
    jobPart                             list(domain(JobPart))
    emailTemplate                       domain(OrganizationEmailTemplate)
    cc                                  list(string)                               O

response: empty

List By User (Assigned To)

action: api/v6/job/listByAssignedTo
    token                               string
    assignedTo                          domain(User)
    status                              enum(JobStatus)

response: JSON
 [
   {
     "id":1,
     "project":{
       "id":1,
       "targetLangs":[
         "cs",
         "de"
       ],
       "status":"NEW",
       "sourceLang":"en",
       "name":"project",
       "dateCreated":"2013-07-16T12:07:08Z",
       "dateDue":null,
       "note":null
     },
     "status":"NEW",
     "targetLang":"de",
     "task":"Tn1gJNpyxBsTKFYE0",
     "assignedTo":{
       "id":2,
       "lastName":"test",
       "email":"test@test.com",
       "userName":"linguist",
       "role":"LINGUIST",
       "active":true,
       "firstName":"linguist"
     },
     "fileName":"small.properties",
     "dateCreated":"2013-07-16T12:07:10Z",
     "dateDue":null,
     "workflowLevel":1,
     "isParentJobSplit":false,
     "wordsCount": 331,
     "beginIndex":0,
     "endIndex":14
   }
 ]

Split By Parts Count

action: api/v6/job/splitByPartsCount
    token                               string
    jobPart                             domain(JobPart)
    partsCount                          integer

response: JSON
 [
   65321,65322,65323            // list of new JobPart identifiers
 ]

Split By Part Size

action: api/v6/job/splitByPartSize
    token                               string
    jobPart                             domain(JobPart)
    partSize                            integer

response: JSON
 [
   65321,65322,65323            // list of new JobPart identifiers
 ]