Show / Hide Table of Contents

# Interface ITMService

This interface has operations for listing, repairing and deleting TMs published by the server, importing TMX and exporting TMX.

### Overview

##### Warning

Lookup, concordance and add/update entry operations are deprecated, and will be eliminated in a future version. From now on the new memoQ Server Resources API is to be used instead.

##### Syntax

    public interface ITMService

### Methods

#### AddNextTMXChunk(Guid, Byte[])

Performs the import of a TMX file chunk. The operation should be called in turns to import the next chunk of the TMX document. It is not required that the chunk ends/begins at a valid TMX XML part. The operation does not return until the segments included in the TMX chunk are imported (except from the last partially provided segment of the chunk). It is important that the interval between two AddNextTMXChunk calls (and the interval between the call of BeginChunkedTMXImport and the first call of AddNextTMXChunk) is less than a minute or two. If the interval is larger, then the TMX import session times out on the server and reserved resources (such as TM locks) are released, the import can not continue.

##### Declaration

    void AddNextTMXChunk(Guid sessionId, byte[] tmxData)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | sessionId | The session id (guid) of the chunked TMX import session created by BeginChunkedTMXImport.
Byte[] | tmxData | The next chunk of data to be imported into the TM. The data size should be approximately 500 KBytes. The encoding of the chunk must be UTF-16 LE.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### AddOrUpdateEntry(String, String, Guid)

!!! DEPRECATED !!! Adds or updates an existing entry to a TM published by the server. This operation requires a valid user session. The operation may throw various types of exceptions in case of error. The recognized errors are: invalid session or session id, no valid license for this function, error reported by the TM (such as reverse lookup requested but not supported), input xml format error, and other uncategorized errors.

##### Declaration

    void AddOrUpdateEntry(string sessionId, string segmentDataXml, Guid tmGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
String | sessionId | The session id belonging to the user who performs the lookup. Permissions are checked against the user of this session.
String | segmentDataXml | An xml document as a string which contains a single segment data to store/update in the TM. For requirements and schema please consult the documentation.
Guid | tmGuid | The Guid of the single TM to perform the concordance against.

##### Exceptions

Type | Condition
--- | ---
InvalidSessionIdFault | The specified session is not valid.
UnauthorizedAccessFault | The user session does not have permission for this operation.
NoLicenseFault | The server has no license for this operation.
RequestXmlFormatFault | The data in xml format is not valid.
TMFault | The TM does not applow the specific operation. The specific cause is included in the fault: TM does not exist TM does not support reverse lookup; when reverse lookup was TM is busy with an exclusive operation TM is readonly TM is corrupt
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### BeginChunkedTMXExport(Guid)

Starts a new chunked TMX export session.

##### Declaration

    Guid BeginChunkedTMXExport(Guid tmGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tmGuid | The guid of the TM whose content is to be exported as TMX.

##### Returns

Type | Description
--- | ---
Guid | The session id (guid) of the newly started chunked TMX export session. It should be provided as first parameter for the GetNextTMXChunk and EndChunkedTMXExport operations.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### BeginChunkedTMXImport(Guid)

Starts a new chunked TMX import session.

##### Declaration

    Guid BeginChunkedTMXImport(Guid tmGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tmGuid | The guid of an already existing TM into which the TMX data is to be imported.

##### Returns

Type | Description
--- | ---
Guid | The session id (guid) of the newly started chunked TMX import session. It should be provided as first parameter for the AddNextTMXChunk and EndChunkedTMXImport operations.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### BeginChunkedTMXImport2(Guid, TmxImportSettings)

Starts a new chunked TMX import session.

##### Declaration

    Guid BeginChunkedTMXImport2(Guid tmGuid, TmxImportSettings settings)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tmGuid | The guid of an already existing TM into which the TMX data is to be imported.
TmxImportSettings | settings | The settings used for the TMX import.

##### Returns

Type | Description
--- | ---
Guid | The session id (guid) of the newly started chunked TMX import session. It should be provided as first parameter for the AddNextTMXChunk and EndChunkedTMXImport operations.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### Concordance(String, String, Guid, ConcordanceRequest)

!!! DEPRECATED !!! Performs a concordance search for a string expression in a single TM published by the server. This operation requires a valid user session. The operation may throw various types of exceptions in case of error. The recognized errors are: invalid session or session id, no valid license for this function, error reported by the TM (such as reverse lookup requested but not supported), and other uncategorized errors.

##### Declaration

    string Concordance(string sessionId, string searchExpression, Guid tmGuid, ConcordanceRequest options)

##### Parameters

Type | Name | Description
--- | --- | ---
String | sessionId | The session id belonging to the user who performs the lookup. Permissions are checked against the user of this session.
String | searchExpression | A string search expression, including wildcard characters.
Guid | tmGuid | The Guid of the single TM to perform the concordance against.
ConcordanceRequest | options | Other configuration options that specify the details of the concordance search.

##### Returns

Type | Description
--- | ---
String | A valid Xml document as a string which containt the lookup results. The string matched the schema in the documentation.

##### Exceptions

Type | Condition
--- | ---
InvalidSessionIdFault | The specified session is not valid.
UnauthorizedAccessFault | The user session does not have permission for this operation.
NoLicenseFault | The server has no license for this operation.
TMFault | The TM does not applow the specific operation. The specific cause is included in the fault: TM does not exist TM does not support reverse lookup; when reverse lookup was TM is busy with an exclusive operation TM is readonly TM is corrupt
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### CreateAndPublish(TMInfo)

Creates a new Translation memory and publishes is on the server (making it available for use).

##### Declaration

    Guid CreateAndPublish(TMInfo info)

##### Parameters

Type | Name | Description
--- | --- | ---
TMInfo | info | The data structure describing the properties of the new translation memory.

##### Returns

Type | Description
--- | ---
Guid | The identifier of the TM.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### DeleteTM(Guid)

Deletes the TM with the specified Guid.

##### Declaration

    void DeleteTM(Guid tmGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tmGuid | The guid of the TM to be deleted.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### EndChunkedTMXExport(Guid)

Call to close the chunked TMX export session. It is important to call this method after exporting the last chunk of data to release server resources (such as TM locks).

##### Declaration

    void EndChunkedTMXExport(Guid sessionId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | sessionId | The session id (guid) of the chunked TMX import session to be closed. Alway provide an id cerated by the BeginChunkedTMXExport operation.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### EndChunkedTMXImport(Guid)

Call to indicate to the memoQ Server that all chunks have been sent by calling AddNextTMXChunk. Closes the chunked TMX import session. It is important to call this method after importing the last chunk of data to release server resources (such as TM locks).

##### Declaration

    TmxImportResult EndChunkedTMXImport(Guid sessionId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | sessionId | The session id (guid) of the chunked TMX import session to be closed. Always provide an id cerated by the BeginChunkedTMXImport operation.

##### Returns

Type | Description
--- | ---
TmxImportResult | Returns summary information about the import process.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### GetNextTMXChunk(Guid)

Performs the export of a TMX document. The operation should be called in turns to get the next chunk of the TMX document. It is important that the time interval between two GetNextTMXChunk calls (and the interval between the call of BeginChunkedTMXExport and the first call of GetNextTMXChunk) is less than a minute or two. If the interval is larger, the TMX export session times out on the server and reserved resourced (such as TM locks) are released, the export can not continue. It is not guaranteed that the chunk ends/begins at valid TMX XML part.

##### Declaration

    byte[] GetNextTMXChunk(Guid sessionId)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | sessionId | The session id (guid) of the chunked TMX import session created by BeginChunkedTMXExport.

##### Returns

Type | Description
--- | ---
Byte[] | The next chunk of TMX data exported from the TM. If no more data is available, the operation returns null, or an empty array of bytes.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### GetTMInfo(Guid)

Gets detailed information about the specified translation memory.

##### Declaration

    TMInfo GetTMInfo(Guid tmGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tmGuid | The guid of the translation memory.

##### Returns

Type | Description
--- | ---
TMInfo | The TMInfo object describing the translation memory.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### ImportTMMetadataSchemeFromXML(Guid, String)

Import custom fields scheme from XML.

##### Declaration

    ImportTMMetadataSchemeResultInfo ImportTMMetadataSchemeFromXML(Guid tmGuid, string scheme)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tmGuid | The guid of the TM.
String | scheme | The text content of the scheme's XML descriptor.

##### Returns

Type | Description
--- | ---
ImportTMMetadataSchemeResultInfo | The ImportTMMetadataSchemeResultInfo providing information about the result of the operation including any errors and warnings that may have occurred.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### ListTMs(String, String)

Returns the list of translation memories published by the memoQ Server.

##### Declaration

    TMInfo[] ListTMs(string srcLang, string targetLang)

##### Parameters

Type | Name | Description
--- | --- | ---
String | srcLang | Each memoQ TM can store segments for one language pair. This parameter can be used to filter the list based on the SOURCE language of the TMs. The three+(two) letter langusage code of the language is to be provided, such as fre, eng, eng-US. If a three letter language code is provided all three+two letter matches are returned (e.g. if eng is specified then TMs with source language eng-US, eng-GB, ... and eng are returned. If this parameter is null, no source language filtering is applied. Note: if a TM supports reverse lookup, it is returned if its source language matches the target language of the filter, and its target language matches the source language of the filter.
String | targetLang | Can be used to filter the returned list of TMs based on the TARGET language of the TM. The same rules are applied as for the srcLang parameter. It is allowed to provide null for both parameters or to provide not null for both. In the latter case only TMs satisfying both filter criteria are returned.

##### Returns

Type | Description
--- | ---
TMInfo[] |

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### ListTMs2(TMListFilter)

Returns the list of translation memories published by the memoQ Server with optional filtering of the items.

##### Declaration

    TMInfo[] ListTMs2(TMListFilter filter)

##### Parameters

Type | Name | Description
--- | --- | ---
TMListFilter | filter | Optional filter criteria.

##### Returns

Type | Description
--- | ---
TMInfo[] | An array of TMInfo objects each describing one TM.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### LookupSegment(String, String, Guid, LookupSegmentRequest)

!!! DEPRECATED !!! Performs a fuzzy lookup for a single segment in a single TM published by the server. This operation requires a valid user session. The operation may throw various types of exceptions in case of error. The recognized errors are: invalid session or session id, no valid license for this function, error reported by the TM (such as reverse lookup requested but not supported), input xml format error, and other uncategorized errors.

##### Declaration

    string LookupSegment(string sessionId, string lookupDataXml, Guid tmGuid, LookupSegmentRequest options)

##### Parameters

Type | Name | Description
--- | --- | ---
String | sessionId | The session id belonging to the user who performs the lookup. Permissions are checked against the user of this session.
String | lookupDataXml | The xml document as a string, which contains the single segment to lookup. For requirements and schema please consult the documentation.
Guid | tmGuid | The Guid of the single TM to perform the lookup against.
LookupSegmentRequest | options | Other configuration options that specify the details of the lookup.

##### Returns

Type | Description
--- | ---
String | A valid Xml document as a string which containt the lookup results. The string matched the schema in the documentation.

##### Exceptions

Type | Condition
--- | ---
InvalidSessionIdFault | The specified session is not valid.
UnauthorizedAccessFault | The user session does not have permission for this operation.
NoLicenseFault | The server has no license for this operation.
RequestXmlFormatFault | The data in xml format is not valid.
TMFault | The TM does not applow the specific operation. The specific cause is included in the fault: TM does not exist TM does not support reverse lookup; when reverse lookup was TM is busy with an exclusive operation TM is readonly TM is corrupt
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### StartTMRepair(Guid)

Starts a TM Repair background job.

##### Declaration

    TaskInfo StartTMRepair(Guid tmGuid)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | tmGuid | The guid of the TM to be repaired.

##### Returns

Type | Description
--- | ---
TaskInfo | A task descriptor; use TasksService to check for the tasks status.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.

#### UpdateProperties(TMUpdateInfo)

Updates the properties of a translation memory. Renaming a translation memory is also possible by updating its name via this operation.

##### Declaration

    void UpdateProperties(TMUpdateInfo updateInfo)

##### Parameters

Type | Name | Description
--- | --- | ---
TMUpdateInfo | updateInfo | The new properties of the translation memory. The Guid member identifies the translation memory to be updated.

##### Exceptions

Type | Condition
--- | ---
UnexpectedFault | An unexpected error occurred; equivalent of an 501 'Internal server error' http result.
GenericFault | The details within the fault identify the specific error. Thrown for expected business error that have no specific faults.