Guides and Articles

Use this documentation when building your Tekla EPM apps

Tekla EPM Open API: how it works?

Updated: 23 May 2019

Tekla EPM Open API dll file

Tekla EPM Open API interface dll, Tekla.EPM.Interface.dll, is in the Tekla EPM installation directory (C:\Program Files[ x(86)]\Tekla EPM\Tekla EPM 2019\ for example).  

There is only one function in the dll file that can be called. The c-style declaration is:

char *_FabSuiteXML( char * );

COM wrapper allows .NET applications to call the function

A COM wrapper, FabSuiteInterfaceCOM.dll, is available to allow the function to be called from .NET applications.

Parameters and return value with XMLTekla EPM Open API XML request and response

The parameter is a null-terminated character string with the XML request. 

The return value is a null-terminated character string with the XML response. 

Elements of the XML request

The root element of the XML request is FabSuiteXMLRequest.  

The element under FabSuiteXMLRequest indicates the command that should be executed.  

For example, this is an example command to connect to the database:

 

<FabSuiteXMLRequest>
<Connect>
<IPAddress>localhost</IPAddress>
<PortNumber>3306</PortNumber>
<Username>admin</Username>
<Password>fab</Password>
</Connect>
</FabSuiteXMLRequest>

Elements of the XML response

The root element of the XML response is FabSuiteXMLResponse.  

Under FabSuiteXMLResponse there may be XMLError or XMLWarning elements.

XMLError

Here is an XMLError example where the end tag missing:

<FabSuiteXMLRequest>
<Connect>
<IPAddress>localhost</IPAddress>
<PortNumber>3306</PortNumber>
<Username>admin</Username>
<Password>fab</Password>
</Connect>

Missing end tag would produce the following response:

<FabSuiteXMLResponse>
<XMLError>Fatal Error (1, 151): The input ended before all started tags were ended. Last tag started was 'FabSuiteXMLRequest'</XMLError>
</FabSuiteXMLResponse>

If there is an XMLError the request will not be processed.

XMLWarning

In the following XMLWarning example the password is misspelled:

<FabSuiteXMLRequest>
<Connect>
<IPAddress>localhost</IPAddress>
<PortNumber>3306</PortNumber>
<Username>admin</Username>
<Pass>fab</Pass> --Password element misspelled
</Connect>
</FabSuiteXMLRequest>

The unknown password would cause a response like this:

<FabSuiteXMLResponse>
<XMLWarning>Element FabSuiteXMLRequest-&gt;Connect-&gt;Pass (fab) is unknown.</XMLWarning>
<Connect>
<ErrorMessage>Access denied for user 'admin'@'127.0.0.1' (using password: NO)</ErrorMessage>
<Successful>0</Successful>
</Connect>
</FabSuiteXMLResponse>

A XMLWarning will not prevent the request from being processed.  In this case, the connection is attempted with a blank password and the login fails.

Successful

The command response always contains the Successful element:  

  • 1 = successful
  • 0 = unsuccessful

If the request was unsuccessful then there is also an ErrorMessage element to give further information.

Returned data

In addition, if the command returns any data it will also be listed under the response element.  For example, the Version command returns the version number of the Tekla EPM Open API:

<FabSuiteXMLRequest>
<Version/>
</FabSuiteXMLRequest>
<FabSuiteXMLResponse>
<Version>
<Successful>1</Successful>
<InterfaceVersionNumber>3.0.7</InterfaceVersionNumber>
</Version>
</FabSuiteXMLResponse>