Term Base API v2

From Memsource
Jump to: navigation, search

Create New Term Base

action: api/v2/termBase/create
    token                       string
    name                        string
    lang                        list(locale)
    client                      domain(Client)                 O
    businessUnit                domain(BusinessUnit)           O
    domain                      domain(Domain)                 O
    subDomain                   domain(SubDomain)              O
    note                        string                         O

response: JSON
    {
      "id": 1954              // id of the new term base
    }

Edit Term Base

action: api/v2/termBase/edit
    token                       string
    termBase                    domain(TermBase)
    name                        string                         O
    lang                        list(locale)                   O
    client                      domain(Client)                 O N
    businessUnit                domain(BusinessUnit)           O N
    domain                      domain(Domain)                 O N
    subDomain                   domain(SubDomain)              O N
    note                        string                         O N

response: empty

Get Term Base

action: api/v2/termBase/get
    token                       string
    termBase                    domain(TermBase)

response: JSON
    {
      "id":1,
      "internalId":1,
      "name":"TB",
      "langs":[
        "de",
        "en"
      ]
      "dateCreated":"2016-03-01T13:36:21+0000",
      "createdBy": {
         "id": 501,
         "userName": "admin",
         "email": "support@memsource.com"
      }
      "client":null,
      "businessUnit": {
         "id":5,
         "name":"BU Name"
      }
      "domain":null,
      "subDomain":null,
      "note":null
    }

Delete Term Base

action: api/v2/termBase/delete
    token                       string
    termBase                    domain(TermBase)
    purge                       boolean               O(false)

response: empty

List Term Bases

action: api/v2/termBase/list
    token                       string
    page                        integer               O(0)
    name                        string                O
    lang                        list(locale)          O
    client                      domain(Client)        O
    domain                      domain(Domain)        O
    subDomain                   domain(SubDomain)     O

response: JSON
   [
     {
       "id":1,
       "name":"termBase",
       "langs":[
         "de",
         "en"
       ]
     }
   ]

Import Data

action: api/v2/termBase/import
    token                       string
    termBase                    domain(TermBase)
    file                        file                              // TBX or XLSX file
    charset                     string                O(UTF-8)
    strictLangMatching          boolean               O(false)
    updateTerms                 boolean               O(true)

response: JSON
    {
      "langs": ["en", "de"],
      "createdTermsCount": 5,
      "updatedTermsCount": 3
    }

Export Data

action: api/v2/termBase/export
    token                       string
    termBase                    domain(TermBase)
    format                      enum(TermBaseFormat)  O(Tbx)
    charset                     string                O(UTF-8)

response: binary

response headers
    Content-Disposition         file name

Browse Terms

action: api/v2/termBase/browseTerms
    token                       string
    termBase                    domain(TermBase)
    queryLang                   string                          O
    query                       string                          O
    status                      enum(Concept.Term.Status)       O
    page                        integer               O(0)

response: JSON
    [
      {
        "id":"MXEGKRh60Aj4UB8wqYwQZq4w1",
        "writable":true,
        "terms":[
          [
            {
              "text":"Hallo",
              "rtl":false,
              "modifiedAt":1345021894443,
              "status":"New",
              "modifiedBy":{
                "id":0,
                "lastName":null,
                "email":null,
                "userName":"null",
                "role":null,
                "active":false,
                "firstName":null
              },
              "writable":true,
              "caseSensitive":false,
              "lang":"de",
              "id":"v3rAqVBD02P4AS88Hn14NLG51",
              "exactMatch":false,
              "createdBy":{
                "id":0,
                "lastName":null,
                "email":null,
                "userName":"null",
                "role":null,
                "active":false,
                "firstName":null
              },
              "createdAt":1344873944496,
              "conceptId":"MXEGKRh60Aj4UB8wqYwQZq4w1",
              "usage":null,
              "forbidden":false,
              "note":null
            }
          ],
          [
            {
              "text":"hello",
              "rtl":false,
              "modifiedAt":1345021900124,
              "status":"New",
              "modifiedBy":{
                "id":0,
                "lastName":null,
                "email":null,
                "userName":"null",
                "role":null,
                "active":false,
                "firstName":null
              },
              "writable":true,
              "caseSensitive":false,
              "lang":"en",
              "id":"DYS3UmGqMdM21o9Enww8N9R00",
              "exactMatch":false,
              "createdBy":{
                "id":0,
                "lastName":null,
                "email":null,
                "userName":"null",
                "role":null,
                "active":false,
                "firstName":null
              },
              "createdAt":1344873944525,
              "conceptId":"MXEGKRh60Aj4UB8wqYwQZq4w1",
              "usage":null,
              "forbidden":false,
              "note":null
            }
          ]
        ]
      }
    ]

Create New Term

action: api/v2/termBase/createTerm
    token                       string
    termBase                    domain(TermBase)
    conceptId                   string                          O
    text                        string
    lang                        locale
    status                      enum(Concept.Term.Status)       O(New)
    forbidden                   boolean                         O(false)
    exactMatch                  boolean                         O(false)
    caseSensitive               boolean                         O(false)
    usage                       string                          O
    note                        string                          O

response: JSON
    {
      "caseSensitive":false,
      "conceptId":"GSfUgFiiMMS2uJ442sgyfFfO",
      "createdAt":1346410660597,
      "createdBy":{
        "firstName":"admin",
        "id":1,
        "lastName":"test",
        "userName":"admin"
      },
      "exactMatch":false,
      "forbidden":false,
      "id":"NglDdn6C0Cg5IT98o3xgspxn0",
      "lang":"en",
      "modifiedAt":1346410660597,
      "modifiedBy":null,
      "note":null,
      "rtl":false,
      "status":"New",
      "text":"agreement",
      "usage":null
    }

Get Term

action: api/v2/termBase/getTerm
    token                       string
    termBase                    domain(TermBase)
    termId                      long

response: JSON
    // same as in Create New Term

List Terms Of Concept

action: api/v2/termBase/listTermsOfConcept
    token                       string
    termBase                    domain(TermBase)
    conceptId                   string

response: JSON
    {
      "conceptId":"GSfUgFiiMMS2uJ442sgyfFfO",
      "termsPerLang": [
        {
          "lang":"en",
          "terms": [
            ... // same as in Create New Term
          ]
        }
      ]
    }
    // same as in Create New Term

Update Term

action: api/v2/termBase/updateTerm
    token                       string
    termBase                    domain(TermBase)
    termId                      string
    text                        string
    lang                        locale
    status                      enum(Concept.Term.Status)       O
    forbidden                   boolean                         O
    exactMatch                  boolean                         O
    caseSensitive               boolean                         O
    usage                       string                          O
    note                        string                          O

response: empty

Delete Term

action: api/v2/termBase/deleteTerm
    token                       string
    termBase                    domain(TermBase)
    termId                      string

response: empty

Delete Concept

action: api/v2/termBase/deleteConcept
    token                       string
    termBase                    domain(TermBase)
    conceptId                   string

response: empty

Search Terms In Text By Task

action: api/v2/termBase/searchTermsInTextByTask
    token                       string
    task                        task
    text                        string
    reverse                     boolean              O(false)
    zeroLengthSeparator         string               O

response: JSON
   [
     {
       "conceptId":"GSfUgFiiMMS2uJ442sgyfFfO",
       "matches":[
         {
           "text":"World",
           "beginIndex":7
         }
       ],
       "subTerm":false,
       "sourceTerm":{
         "caseSensitive":false,
         "conceptId":"GSfUgFiiMMS2uJ442sgyfFfO",
         "createdAt":1344869104360,
         "createdBy":{
           "firstName":null,
           "id":0,
           "lastName":null,
           "userName":"admin"
         },
         "exactMatch":false,
         "forbidden":true,
         "id":"NglDdn6C0Cg5IT98o3xgspxn0",
         "lang":"en",
         "modifiedAt":1345623087380,
         "modifiedBy":{
           "firstName":"administrator",
           "id":30,
           "lastName":"admin",
           "userName":"admin"
         },
         "note":"",
         "rtl":false,
         "status":"New",
         "text":"world",
         "usage":"",
         "writable":true
       },
       "termBase":{
         "id":23,
         "name":"linguist access"
       },
       "translationTerms":[
         {
           "caseSensitive":false,
           "conceptId":"GSfUgFiiMMS2uJ442sgyfFfO",
           "createdAt":1344869104326,
           "createdBy":{
             "firstName":null,
             "id":0,
             "lastName":null,
             "userName":"admin"
           },
           "exactMatch":false,
           "forbidden":false,
           "id":"NglDdn6C0Cg5IT98o3xgspxn1",
           "lang":"de",
           "modifiedAt":1345118781404,
           "modifiedBy":{
             "firstName":"administrator",
             "id":30,
             "lastName":"admin",
             "userName":"admin"
           },
           "note":"",
           "rtl":false,
           "status":"New",
           "text":"Welt",
           "usage":"",
           "writable":true
         }
       ]
     }
   ]

error codes
      TermBaseNotSelected                                   no term base is selected for the task

Search Terms By Task

action: api/v2/termBase/searchTermsByTask
    token                       string
    task                        task
    query                       string
    reverse                     boolean              O(false)

response: JSON
   [
     {
       "conceptId":"GSfUgFiiMMS2uJ442sgyfFfO",
       "sourceTerm":{
         "caseSensitive":false,
         "conceptId":1,
         "createdAt":1344869104360,
         "createdBy":{
           "firstName":null,
           "id":0,
           "lastName":null,
           "userName":"admin"
         },
         "exactMatch":false,
         "forbidden":true,
         "id":"NglDdn6C0Cg5IT98o3xgspxn0",
         "lang":"en",
         "modifiedAt":1345623087380,
         "modifiedBy":{
           "firstName":"administrator",
           "id":30,
           "lastName":"admin",
           "userName":"admin"
         },
         "note":"",
         "rtl":false,
         "status":"New",
         "text":"world",
         "usage":"",
         "writable":true
       },
       "termBase":{
         "id":23,
         "name":"linguist access"
       },
       "translationTerms":[
         {
           "caseSensitive":false,
           "conceptId":"GSfUgFiiMMS2uJ442sgyfFfO",
           "createdAt":1344869104326,
           "createdBy":{
             "firstName":null,
             "id":0,
             "lastName":null,
             "userName":"admin"
           },
           "exactMatch":false,
           "forbidden":false,
           "id":"NglDdn6C0Cg5IT98o3xgspxn1",
           "lang":"de",
           "modifiedAt":1345118781404,
           "modifiedBy":{
             "firstName":"administrator",
             "id":30,
             "lastName":"admin",
             "userName":"admin"
           },
           "note":"",
           "rtl":false,
           "status":"New",
           "text":"Welt",
           "usage":"",
           "writable":true
         }
       ]
     }
   ]

error codes
      TermBaseNotSelected                                   no term base is selected for the task

Search

action: api/v2/termBase/search
    token                       string
    termBase                    list(domain(TermBase))
    sourceLang                  locale
    targetLang                  list(locale)
    query                       string
    status                      enum(Concept.Term.Status)        O

response: JSON
     see termBase/searchTermsByTask above

Create Term By Task

action: api/v2/termBase/createTermByTask
    token                       string
    task                        task
    sourceText                  string
    sourceForbidden             boolean              O(false)
    sourceExactMatch            boolean              O(false)
    sourceCaseSensitive         boolean              O(false)
    sourceUsage                 string               O
    sourceNote                  string               O
    targetText                  string
    targetForbidden             boolean              O(false)
    targetExactMatch            boolean              O(false)
    targetCaseSensitive         boolean              O(false)
    targetUsage                 string               O
    targetNote                  string               O

response: JSON
   {
     "sourceTerm":{
       "text":"dog",
       "rtl":false,
       "modifiedAt":1364382523388,
       "status":"Approved",
       "modifiedBy":null,
       "writable":true,
       "caseSensitive":false,
       "lang":"en",
       "id":"NglDdn6C0Cg5IT98o3xgspxn0",
       "exactMatch":false,
       "createdBy":{
         "id":1,
         "lastName":"test",
         "email":"foo@bar.com",
         "userName":"admin",
         "role":"LINGUIST",
         "firstName":"admin"
       },
       "createdAt":1364382523388,
       "conceptId":"GSfUgFiiMMS2uJ442sgyfFfO",
       "usage":null,
       "forbidden":false,
       "note":null
     },
     "targetTerm":{
       "text":"Hund",
       "rtl":false,
       "modifiedAt":1364382524193,
       "status":"Approved",
       "modifiedBy":null,
       "writable":true,
       "caseSensitive":false,
       "lang":"de",
       "id":"NglDdn6C0Cg5IT98o3xgspxn1",
       "exactMatch":false,
       "createdBy":{
         "id":1,
         "lastName":"test",
         "email":"foo@bar.com",
         "userName":"admin",
         "role":"LINGUIST",
         "firstName":"admin"
       },
       "createdAt":1364382524193,
       "conceptId":"GSfUgFiiMMS2uJ442sgyfFfO",
       "usage":null,
       "forbidden":false,
       "note":null
     }
   }

error codes
      TermBaseNotSelected                                   no term base is selected for the task

Clear Data

action: api/v2/termBase/clear
    token                       string
    termBase                    domain(TermBase)

response: empty

Get Metadata

action: api/v2/termBase/getMetadata
    token                       string
    termBase                    domain(TermBase)

response: JSON
    {
      "languages": [ "en", "de" ]
      "termsCount": 38
    }