createLibraries Interface

The createLibraries interface is used to create new libraries. The HTTP response of the call contains the XML structure of the changed libraries. You can obtain the identifiers of the new nodes from the updated XML library structure.

The following table shows the parameters of the createLibraries interface.

Interface URL Parameter Descriptions

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

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.

Example: http://<front-end URL>/servicesExchange?hid=createLibraries&sid=<webServiceToken>

The XML schema definition file that is used to validate libraries can be downloaded by using the front-end server URL http://<front-end URL>/silkroot/xsl/libraries.xsd or copied from the front-end server installation folder <Silk Central installation folder>/wwwroot/silkroot/xsl/libraries.xsd.

createLibraries Web Service Example

The following code uses Apache HttpClient to create libraries.

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

String webServiceToken = "e39a0b5b-45db-42db-84b2-b85028d954d5";

URL service = new URL("http", mWebServiceHelper.getHost(),
  mWebServiceHelper.getPort(), String.format("/servicesExchange?hid=%s&sid=%s",
  "createLibraries", webServiceToken));
HttpClient client = new HttpClient();
PostMethod filePost = new PostMethod(service.toExternalForm());
String xmlFile = loadTestPlanUtf8("libraries.xml");
StringPart xmlFileItem = new StringPart("libraries", xmlFile, "UTF-8");
Part[] parts = {xmlFileItem};

filePost.setRequestEntity(new MultipartRequestEntity(parts, filePost.getParams()));
int status = client.executeMethod(filePost);

To download Apache HttpComponents, visit Refer to the documentation of the component for the required libraries.

Libraries Example

The following code shows an example library that can be uploaded to Silk Central by using the createLibraries service. A new library is not restricted to be used in certain projects, unless one or more projects are defined in the GrantedProjects Section.

<?xml version="1.0" encoding="UTF-8"?>
<LibraryStructure xmlns=""
  xsi:schemaLocation="http://<front-end URL>/silkroot/xsl/libraries.xsd">

  <Library name="Library 1">
    <Folder name="Folder 1">
      <Folder name="Folder 1.1">
        <SharedSteps name="Basic create user steps">
          <Step name="Login">
              Login with user admin.
            <ExpectedResult>Succesful login.</ExpectedResult>
            <CustomStepProperty name="Step Property 1">
                        <propertyValue>Step Property Value</propertyValue>
          <Step name="Create User">
            <ActionDescription>Create user tester</ActionDescription>
            <ExpectedResult>User created</ExpectedResult>
            <CustomStepProperty name="Step Property 1">
                        <propertyValue>Step Property Value</propertyValue>
          <Step name="Logout">
              Logout using start menu
            <ExpectedResult>Logged out.</ExpectedResult>
            <CustomStepProperty name="Step Property 1">
                        <propertyValue>Step Property Value</propertyValue>