Glossary Resource

Glossary management

DELETE /glossary

Delete all entries in a glossary.

Request Parameters
name type description default
qualifiedName query Qualified name of glossary, defaults to #GLOBAL_QUALIFIED_NAME global/default
Response Codes
code condition
200 The glossary was deleted
401 The user does not have the proper permissions to perform this operation
500 If there is an unexpected error in the server while performing this operation
Response Body
media type data type description
application/json number (JSON) The number of deleted glossary entries
application/octet-stream (custom)
application/vnd.zanata.glossary+json number (JSON)
application/vnd.zanata.glossary+xml int (XML)
application/xml int (XML)

Example

Request
DELETE /glossary
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...
                
              

POST /glossary

Upload glossary file (currently supported formats: po, csv)

Request Body
media type data type description
multipart/form-data (custom) Multi-part form with the following named parts:
file: The file contents
srcLocale: Source locale for the glossary entries
transLocale: Translation locale for the glossary entries
fileName: The name of the file being uploaded
qualifiedName: The qualified name for the glossary
Response Codes
code condition
201 Files successfully uploaded
401 The user does not have the proper permissions to perform this operation
500 If there is an unexpected error in the server while performing this operation
Response Body
media type data type
application/json Glossary Results (JSON)

Example

Request
POST /glossary
Content-Type: multipart/form-data
Accept: application/json

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
{
  "glossaryEntries" : [ {
    "id" : 444555,
    "pos" : "verb",
    "description" : "...",
    "srcLang" : "en-US",
    "sourceReference" : "...",
    "glossaryTerms" : [ {
      "content" : "Una casa",
      "comment" : "...",
      "locale" : "es-ES",
      "lastModifiedDate" : 12345,
      "lastModifiedBy" : "homer"
    }, {
      "content" : "家",
      "comment" : "...",
      "locale" : "ja",
      "lastModifiedDate" : 12345,
      "lastModifiedBy" : "..."
    } ],
    "termsCount" : 2,
    "qualifiedName" : {
      "name" : "global/default"
    }
  }, {
    "id" : 444556,
    "pos" : "noun",
    "description" : "...",
    "srcLang" : "...",
    "sourceReference" : "...",
    "glossaryTerms" : [ {
      "content" : "家",
      "comment" : "...",
      "locale" : "ja",
      "lastModifiedDate" : 12345,
      "lastModifiedBy" : "..."
    }, {
      "content" : "家",
      "comment" : "...",
      "locale" : "ja",
      "lastModifiedDate" : 12345,
      "lastModifiedBy" : "..."
    } ],
    "termsCount" : 12345,
    "qualifiedName" : {
      "name" : "..."
    }
  } ],
  "warnings" : [ "...", "..." ]
}
                
              
See Also
Glossary Entry for details on the result list's contents.

GET /glossary/entries

Returns a subset of Glossary entries for the given source and translation locale as indicated by the paging parameters.

See Also
Glossary Entry for details on the result list's contents.
Request Parameters
name type description default constraints
filter query String filter for source content    
page query Current request page (default value: 1) 1 int
qualifiedName query Qualified name of glossary, default to #GLOBAL_QUALIFIED_NAME global/default  
sizePerPage query Size of entry per page (default/max value: 1000) #MAX_PAGE_SIZE 1000 int
sort query Fields to sort. Comma separated. e.g sort=desc,-part_of_speech See org.zanata.common.GlossarySortField    
srcLocale query Source locale - Required (default value: en-US). en-US  
transLocale query Translation locale    
Response Codes
code condition
200 Response containing Glossary entries for the given locale.
400 If page or sizePerPage are negative, or sizePerPage is greater than 1000
500 If there is an unexpected error in the server while performing this operation
Response Body
media type data type
application/json Result List (JSON)
application/vnd.zanata.glossary+json Result List (JSON)

Example

Request
GET /glossary/entries
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "results" : [ { }, { } ],
  "totalCount" : 12345
}
                
              

POST /glossary/entries

Create or update glossary entries. Glossary Terms with a locale different from the given locale parameter will be ignored.

Request Parameters
name type description default
locale query Locale to which the given glossary entries belong  
qualifiedName query Qualified name of glossary, defaults to #GLOBAL_QUALIFIED_NAME global/default
Request Body
media type data type description
application/json array of Glossary Entry (JSON) The glossary entries to create/update
application/xml list of Glossary Entry (XML)
Response Codes
code condition
200 The glossary entries were successfully created or updated
401 The user does not have the proper permissions to perform this operation
500 If there is an unexpected error in the server while performing this operation
Response Body
media type data type
application/json Glossary Results (JSON)
application/xml Glossary Results (XML)

Example

Request
POST /glossary/entries
Content-Type: application/json
Accept: application/json

                
[ {
  "id" : 444555,
  "pos" : "verb",
  "description" : "...",
  "srcLang" : "en-US",
  "sourceReference" : "...",
  "glossaryTerms" : [ {
    "content" : "Una casa",
    "comment" : "...",
    "locale" : "es-ES",
    "lastModifiedDate" : 12345,
    "lastModifiedBy" : "homer"
  }, {
    "content" : "家",
    "comment" : "...",
    "locale" : "ja",
    "lastModifiedDate" : 12345,
    "lastModifiedBy" : "..."
  } ],
  "termsCount" : 2,
  "qualifiedName" : {
    "name" : "global/default"
  }
} ]
                
              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "glossaryEntries" : [ {
    "id" : 444555,
    "pos" : "verb",
    "description" : "...",
    "srcLang" : "en-US",
    "sourceReference" : "...",
    "glossaryTerms" : [ {
      "content" : "Una casa",
      "comment" : "...",
      "locale" : "es-ES",
      "lastModifiedDate" : 12345,
      "lastModifiedBy" : "homer"
    }, {
      "content" : "家",
      "comment" : "...",
      "locale" : "ja",
      "lastModifiedDate" : 12345,
      "lastModifiedBy" : "..."
    } ],
    "termsCount" : 2,
    "qualifiedName" : {
      "name" : "global/default"
    }
  }, {
    "id" : 444556,
    "pos" : "noun",
    "description" : "...",
    "srcLang" : "...",
    "sourceReference" : "...",
    "glossaryTerms" : [ {
      "content" : "家",
      "comment" : "...",
      "locale" : "ja",
      "lastModifiedDate" : 12345,
      "lastModifiedBy" : "..."
    }, {
      "content" : "家",
      "comment" : "...",
      "locale" : "ja",
      "lastModifiedDate" : 12345,
      "lastModifiedBy" : "..."
    } ],
    "termsCount" : 12345,
    "qualifiedName" : {
      "name" : "..."
    }
  } ],
  "warnings" : [ "...", "..." ]
}
                
              

GET /glossary/file

Download all glossary entries as a file

Request Parameters
name type description default
fileType query 'po' or 'csv' (case insensitive) are currently supported csv
locales query optional comma separated list of languages required.  
qualifiedName query Qualified name of glossary, default to #GLOBAL_QUALIFIED_NAME global/default
Response Codes
code condition
200 File is successfully built and served
500 If there is an unexpected error in the server while performing this operation
Response Body
media type data type description
application/octet-stream (custom) A file stream with the glossary contents in the specified format

Example

Request
GET /glossary/file
Accept: application/octet-stream

              
Response
HTTP/1.1 200 OK
Content-Type: application/octet-stream

                
...
                
              

GET /glossary/info

Return source locales available for all glossary entries

Request Parameters
name type description default
qualifiedName query Qualified name of glossary, default to #GLOBAL_QUALIFIED_NAME global/default
Response Codes
code condition
200 Returns the global glossary information
500 If there is an unexpected error in the server while performing this operation
Response Body
media type data type
application/json Glossary Info (JSON)
application/vnd.zanata.glossary+json Glossary Info (JSON)
application/vnd.zanata.glossary+xml Glossary Info (XML)
application/xml Glossary Info (XML)

Example

Request
GET /glossary/info
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "srcLocale" : {
    "locale" : {
      "localeId" : "es-ES",
      "displayName" : "Spanish (Spain)",
      "alias" : "es",
      "nativeName" : "Español",
      "enabled" : true,
      "enabledByDefault" : true,
      "pluralForms" : "nplurals=2; plural=(n != 1)",
      "rtl" : true
    },
    "numberOfTerms" : 2
  },
  "transLocale" : [ {
    "locale" : {
      "localeId" : "es-ES",
      "displayName" : "Spanish (Spain)",
      "alias" : "es",
      "nativeName" : "Español",
      "enabled" : true,
      "enabledByDefault" : true,
      "pluralForms" : "nplurals=2; plural=(n != 1)",
      "rtl" : true
    },
    "numberOfTerms" : 2
  }, {
    "locale" : {
      "localeId" : "ja",
      "displayName" : "Japanese",
      "alias" : "ja-JP",
      "nativeName" : "日本語",
      "enabled" : true,
      "enabledByDefault" : true,
      "pluralForms" : "nplurals=1; plural=0",
      "rtl" : true
    },
    "numberOfTerms" : 12345
  } ]
}
                
              

GET /glossary/qualifiedName

Return default global glossary qualifiedName

Response Codes
code condition
200 Returns the qualified name for the system-wide glossary
500 If there is an unexpected error in the server while performing this operation
Response Body
media type data type
application/json Qualified Name (JSON)
application/vnd.zanata.glossary+json Qualified Name (JSON)
application/vnd.zanata.glossary+xml Qualified Name (XML)
application/xml Qualified Name (XML)

Example

Request
GET /glossary/qualifiedName
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "name" : "global/default"
}
                
              
See Also
Glossary Entry for details on the result list's contents.

GET /glossary/search

Returns Glossary entries based on a fuzzy text search.

See Also
Glossary Entry for details on the result list's contents.
Request Parameters
name type description default constraints
maxResults query Maximum results for global and project queries. May return up to double this number. Default: 20 20 int
project query (optional) Project slug if a project glossary should be searched in addition to the global glossary.    
searchText query Text containing terms to match in the search.    
srcLocale query Source locale en-US  
transLocale query Translation locale    
Response Codes
code condition
200 Response containing Glossary entries for the given search parameters.
400 When maxResults is not strictly positive or is more than 1000
400 When searchText is missing
400 When transLocale is missing
400 When there is an error parsing the searchText
500 If there is an unexpected error in the server while performing this operation
Response Body
media type data type
application/json Result List (JSON)
application/vnd.zanata.glossary+json Result List (JSON)

Example

Request
GET /glossary/search
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "results" : [ { }, { } ],
  "totalCount" : 12345
}
                
              

GET /glossary/details/{locale}

Get the details for a set of glossary terms. Includes source details, and details from the given locale.

Request Parameters
name type description constraints multivalued
locale path include locale-specific detail for this locale   no
termIds query id for glossary terms in the default locale, found in results of #search(LocaleId, LocaleId, int, String, String) long yes
Response Codes
code condition
200 Details successfully found
500 If there is an unexpected error in the server while performing this operation
Response Body
media type data type description
application/json object (JSON) Source and target glossary details.
application/vnd.zanata.glossary+json object (JSON)

Example

Request
GET /glossary/details/{locale}
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
...
                
              

DELETE /glossary/entries/{id}

Delete a glossary entry.

Request Parameters
name type description default constraints
id path id for source glossary term   long
qualifiedName query Qualified name of glossary, defaults to #GLOBAL_QUALIFIED_NAME global/default  
Response Codes
code condition
200 The glossary entry was successfully deleted
401 The user does not have the proper permissions to perform this operation
500 If there is an unexpected error in the server while performing this operation
Response Body
media type data type description
application/json Glossary Entry (JSON) the removed glossary entry

Example

Request
DELETE /glossary/entries/{id}
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "id" : 444555,
  "pos" : "verb",
  "description" : "...",
  "srcLang" : "en-US",
  "sourceReference" : "...",
  "glossaryTerms" : [ {
    "content" : "Una casa",
    "comment" : "...",
    "locale" : "es-ES",
    "lastModifiedDate" : 12345,
    "lastModifiedBy" : "homer"
  }, {
    "content" : "家",
    "comment" : "...",
    "locale" : "ja",
    "lastModifiedDate" : 12345,
    "lastModifiedBy" : "..."
  } ],
  "termsCount" : 2,
  "qualifiedName" : {
    "name" : "global/default"
  }
}