TMAttach Interface

The TMAttach interface is used to upload attachments to a test or requirement. The following table shows the parameters of the TMAttach interface.

Interface URL Parameter Descriptions

http://<front-end URL>/servicesExchange?hid=TMAttach

sid Web-service token or session identifier for user authentication. You can generate the web-service token in the Settings Page of the Silk Central UI. To access this page, hover the mouse cursor over the user name in the Silk Central menu and select User Settings. You can retrieve the session identifier by invoking the logonUser method of one of the Available Web Services.
  entityType Target entity type:

(test, requirement, or TestStepParent)

  entityID Target entity ID:

(test ID, requirement ID, or manual test ID)

  description Description of the attachment:

URL encoded text, used to describe the attachment.

  isURL If true, the attachment is a URL. If false, the attachment is a file.
  URL Optional - URL to be attached.
  stepPosition Optional - Test step order. Identifies the step of a manual test (for example, the order of the first step is 1). The order is mandatory if the entityType is TestStepParent.

Example: http://<front-end URL>/servicesExchange?hid=TMAttach&entityType=<test, requirement, or TestStepParent>&entityID=<id>&description=<text>&isURL=<true or false>&URL=<URL>&stepPosition=<number>&sid=<webServiceToken>

TMAttach Web Service Example

The following code uses Apache HtmlClient to get a convenient HTTP-POST API for uploading a binary attachment. Only one attachment can be uploaded per request.

Only one attachment can be uploaded per request. To download Apache HttpComponents, visit Refer to the documentation of the component for the required libraries.

import org.apache.commons.httpclient.*; // Apache HttpClient

	String webServiceToken = "e39a0b5b-45db-42db-84b2-b85028d954d5"; // Token generated in the UI
	String testNodeID = null; // receiving test
	File fileToUpload = null; // attachment
	String AttachmentDescription = ""; // descriptive text

	HttpClient client = new HttpClient();
	String formURL = "http://localhost:19120/
		servicesExchange?hid=TMAttach" +
		"&sid=" + webServiceToken +
		"&entityID=" + testNodeID +
		"&entityType=Test" + 
	PostMethod filePost = new PostMethod(formURL);
	Part[] parts = {
		new StringPart("description", attachmentDescription),
		new FilePart(fileToUpload.getName(), fileToUpload)
	filePost.setRequestEntity(new MultipartRequestEntity(parts,
	// Execute and check for success
	int status = client.executeMethod(filePost);
	// verify http return code...
	// if(status == httpStatus.SC_OK) ...