Layer7 API Management

  • 1.  RESTMAN API Samples

    Posted 11-08-2016 07:30 AM

    As new use I am struggling with the restman API interface.  My Guess is that I am doing something basically wrong, but I cant get the templates to run.

    1. run policy/template

    2. Copy the policy section out

    3. Attempt to post the template in SOAP-UI


    All I ever get is policy falsified.  The docs have a sample for folders that I can get to work,  but is there a place wher I can get samples for the other types of objects?

  • 2.  Re: RESTMAN API Samples
    Best Answer

    Posted 11-08-2016 08:35 PM

    Hi wertzmp


    In order to PUT or POST with Restman you will need to tailor the GET response. I've attached an examples for rest man GET, PUT and POST using service as the example resource type. 


    The Example's I ran below were using the Firefox browser extension "RESTClient". I set the following

    Content-Type Header application/xml

    Authentication Basic (policy manager admin credentials)


    Service GET Example:

    1. Perform a get or navigate to the restman url:

    For reference: ExampleServiceGET.xml


    PUT Example to disable the existing service:

    1. Relocate the name space to the Service element and strip the GET response down to the Service element and increment the version of the latest request

    2. In the example below I increment the EXAMPLESERVICE to version 2 and change the "Enabled" element to false which disable the service in Policy Manager.

    3. Send a PUT request to https://gatewayaddress:9443/restman/1.0/services/d1733a2484c853213614bccbbd779c61 

    For reference: ExampleServicePUT.xml


    POST Example to create a new service named EXAMPLESERVICE1

    1. Remove the Version and Service & Folder ID's from the aforementioned PUT request.

    2. Change the Name element to 'EXAMPLESERVICE1' and change the UrlPattern element to /exampleservice1

    3. Send a POST request to https://gatewayaddress:9443/restman/1.0/services 

    For reference: ExampleServiceGET.xml


    To recap, a GET is returning the ITEM xml in its entirety with the actual resource as an element within the ITEM. To POST or PUT a resource you will need to relocate the name space to the resource element, strip the ITEM down to the resource element and send that to the appropriate restman URL. The restman docs available on your gateway will tell you the appropriate target URL depending on the resource type you are using. 


    If you have any other questions please feel free to ask.





    Kevin Russell

    Support Engineer, Global Customer Success


    Phone: +1 800 225 5224

    Outside of North America -

    CA API Management Community:


    zip   939 B 1 version
    zip   750 B 1 version
    zip   801 B 1 version

  • 3.  Re: RESTMAN API Samples

    Posted 01-09-2017 02:09 PM

    I was able to create a service using this restman/1.0/services


     to create I have learned we need to do two steps

    1. using get service get a sample service
    2. using XML in the result of 1 we can create one service

    but post method will always create service if we call same two times 

    two services are created with same name and context path

  • 4.  Re: RESTMAN API Samples

    Posted 11-09-2016 03:03 PM

    maybe this helps as well : "GMU Tool : Basic migrateOut and migrateIn Examples"
    see link below 

    Knowledge Base Articles 

  • 5.  Re: RESTMAN API Samples

    Posted 11-10-2016 02:18 PM

    Ok, so don't use the backspace


    I am trying to automate the maintenance of the gateway where when I get new policy checked into git I can then automatically deploy the updates.  So needed to be able to do these one at a time.  so far it seems to be working well, but the getting the xml formatted correctly to do the post/put has been a challenge.  thanks for the help