Job API v4

From Memsource
Jump to: navigation, search

Create New Job

action: api/v4/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
    zipCharset                                           charset                  O
    tableOfContents                                      boolean                  O(false)
    notes                                                boolean                  O(false)
    masterSlides                                         boolean                  O(false)
    idmlExtractNotes                                     boolean                  O(false)
    idmlSimplifyCodes                                    boolean                  O(false)
    idmlExtractMasterSpreads                             boolean                  O(false)
    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)
    xlsSheetNames                                        boolean                  O(false)
    xlsDrawings                                          boolean                  O(false)
    xlsHidden                                            boolean                  O(false)
    xlsComments                                          boolean                  O(false)
    xlsOther                                             boolean                  O(false)
    xlsCellFlow                                          enum(XlsCellFlow)        O(ColumnDownRight)
    docComments                                          boolean                  O(false)
    docIndex                                             boolean                  O(true)
    docOther                                             boolean                  O(false)
    pptHiddenSlides                                      boolean                  O(false)
    pptOther                                             boolean                  O(false)
    jsonCodeFinderRegexp                                 string                   O()
    xmlIncludeTags                                       string                   O(*)               // example: "para,heading"
    xmlExcludeTags                                       string                   O()                // example: "script,object"
    xmlIncludeAttributes                                 string                   O()                // example: "title"
    xmlExcludeAttributes                                 string                   O()                // example: "lang,href"
    xmlSignificantLineBreak                              boolean                  O(false)
    xmlInlineTags                                        string                   O()                // example: "tt,b"
    xmlInlineTagsNonTranslatable                         string                   O()                // example: "tt,b"
    xmlSubFilterCdata                                    boolean                  O(false)
    xmlSubFilterTags                                     string                   O()                // example: "tt,b"
    xmlEntities                                          boolean                  O(false)
    htmlBreakTagCreatesSegment                           boolean                  O(true)
    htmlUnknownTagCreatesTag                             boolean                  O(true)
    htmlPreserveWhitespace                               boolean                  O(false)
    xlfImportNotes                                       boolean                  O(true)
    xlfSkipImportRules                                   string                   O()                // 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)
    xlfSegmentation                                      boolean                  O(true)
    sdlXlfSkipImportRules                                string                   O()                // example: "translate=yes,locked=true,state=Draft"
    sdlXlfImportAsConfirmedRules                         string                   O()                //          multiples rules must be separated by newline or semicolon
    sdlXlfImportAsLockedRules                            string                   O()
    sdlXlfExportAttrsWhenConfirmedAndLocked              string                   O()
    sdlXlfExportAttrsWhenConfirmedAndNotLocked           string                   O()
    sdlXlfExportAttrsWhenNotConfirmedAndLocked           string                   O()
    sdlXlfExportAttrsWhenNotConfirmedAndNotLocked        string                   O()
    sdlXlfSaveConfirmedSegments                          boolean                  O(true)
    ttxSaveConfirmedSegments                             boolean                  O(true)
    charset                                              charset                  O

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

error codes
    JobCreateError

Edit Job

action: api/v4/job/edit
    token                       string
    jobPart                     domain(JobPart)
    due                         datetime                 O N
    linguist                    domain(User)             O N 
    status                      enum(JobStatus)          O

response: empty

Delete Job

action: api/v4/job/delete
    token                       string
    jobPart                     domain(JobPart)

response: empty

Get Job

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

response: JSON
    {
      "id": 9372,
      "task": "5087ab08eac015e0656c4a00",
      "fileName": "my.doc",
      "targetLang": "en",
      "workflowLevel": 1,
      "status": "NEW",
      "isParentJobSplit": false,
      "assignedTo": {
        "id": 501,
        "userName": "admin",
        "email": "support@memsource.com"
      }
      "project": {
        "id": 25,
        "name: "project"
        ... 
      }
    }

List Jobs

action: api/v4/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,
        "assignedTo": {
          "id": 501,
          "userName": "admin",
          "email": "support@memsource.com"
        }
      }
    ]

List Jobs By Task

action: api/v4/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,
        "assignedTo": {
          "id": 501,
          "userName": "admin",
          "email": "support@memsource.com"
        }
      }
   ]

Get Original File

By Job Part

action: api/v4/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/v4/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/v4/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/v4/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/v4/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/v4/job/getCompletedFileByTask
    token                       string
    task                        task
    workflowLevel               integer              O(1)

response: binary

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

Upload Bilingual File

action: api/v4/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,
        "assignedTo": {
          "id": 501,
          "userName": "admin",
          "email": "support@memsource.com"
        }
      }
    ]

Convert Bilingual File

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

response: binary

Machine Translation

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

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

error codes
    MachineTranslateNotSelected

Get Translation Resources

action: api/v4/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/v4/job/setStatus
    token                       string
    jobPart                     domain(JobPart)
    status                      enum(JobStatus)

response: empty

Get Segments Count ("Get Progress")

action: api/v4/job/getSegmentsCount
    token                       string
    jobPart                     domain(JobPart)

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/v4/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/v4/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/v4/job/compareBilingualFile
    token                       string
    bilingualFile               file
    compareToLevel              int

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

List By Project

action: api/v4/job/listByProject
    token                       string
    project                     domain(Project)

response: JSON
   [
     {
       "workflowStep":null,
       "jobParts":[
         {
           "id":1,
           "task":"4ZDvyB1uwBY08eAh1",
           "fileName":"small.properties",
           "targetLang":"de",
           "workflowLevel":1,
           "status":"NEW",
           "isParentJobSplit":false,
           "assignedTo":{
             "active":true,
             "email":"test@test.com",
             "firstName":"linguist",
             "id":2,
             "lastName":"test",
             "role":"LINGUIST",
             "userName":"linguist"
           },
           "dateDue":null,
           "dateCreated":"2013-05-13T12:52:17Z"
         }
       ]
     }
   ]

Pre-translate

action: api/v4/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)
    confirmNonTranslatables             boolean                    O(false)
    confirm100Matches                   boolean                    O(false)
    confirm101Matches                   boolean                    O(false)
    lock101Matches                      boolean                    O(false)

response: empty

List By User (Assigned To)

action: api/v4/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
   }
 ]