How to upload Server Module Files through Restman API

Document ID : KB000101540
Last Modified Date : 18/06/2018
Show Technical Document Details
The RESTMAN API has instructions on listing, creating, updating, and deleting Server Module Files to an API Gateway at this location:

Using the RESTMAN documentation to create or POST a new Server Module File proves difficult in most cases whether using curl, postman, SOAPUI, or any REST API implementation strategy.
Use this kb article to gain a better understanding of what data is needed to successfully create a new Server Module File on your Gateway.
API Gateway 9.3
Gateway REST Management Service /restman/*
SOAP UI 5.40

In this use case we are going to install the Server Module File using Policy Manager first, get the detail via REST call, delete it, and re-create it using SOAP UI.

The only way to get the proper server module detail is to first upload the saar file using policy manager and then using the following uri to GET the detail of the module in xml format.

This will list all of your currently installed serverModuleFiles. You can alternatively use the Id of the target Server module noted in the RESTMAN docs:  1.0/serverModuleFiles/{id}
So you can be sure that what you copy is specific to your intended module file details.
Copy this detail to your preferred editor. Note that you will not merely copy this detail back into SOAP UI or your POST tool. You will be copying the needed string values into the template below. This is to avoid formatting errors or other http based errors as not all of the data in the GET response is required.

This is your template that you would POST with:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<l7:ServerModuleFile xmlns:l7="">
<l7:Property key="cert">
<l7:Property key="signature">
<l7:Property key="moduleAssertions">
<l7:Property key="moduleFileName">
<l7:Property key="moduleSize">

SOAPUI would need to be configured with a trusted certificate if you are to connect to a secure port. Or you can modify the RESTMAN policy to allow only basic auth and then POST on a non-ssl port. The choice is yours.
In SOAP UI you need to specify an Id string in the resource field. You can use the Id from the output retrieved during the GET call.
Example: /restman/1.0/serverModuleFiles/78cbd6a04ab448f1a0e78b653a4c4dc1

Attached is an example of a jvm Metrics Custom Assertion xml
Additional Information:
This can also be used in gmu.bat via the following command:
gmu.bat restman -h gatewayHostName -u admin --plaintextPassword password --trustCertificate --method POST --path 1.0/serverModuleFiles --trustHostname --request serverModuleFile.txt

Here is the curl variant submitted by a customer:
curl -u admin:$PASSWORD --insecure --data "@/path/to/serverModuleFile.xml" --header "Content-Type:application/xml" --request POST https://localhost:9443/restman/1.0/serverModuleFiles

This article is limited to using SOAP UI and will not include instructions on setting up SOAP UI to make calls to API Gateway, nor configuring GMU, or curl.
File Attachments: