cancel
Showing results for 
Search instead for 
Did you mean: 

VTM 17.4 Rest API Rule Creation

New Contributor

VTM 17.4 Rest API Rule Creation

Hello, 

I'm attempting to automate some of the processes of configuring the VTM. I've been able to create a new pool with the 5.1 Rest API, and I have been able to create a new rule, but I've so far been unsuccesful in my attempts to configure this rule. I need to update the rule so that it has an http only "host contains MYURL" and then choose a pool when that rule is met. 

Can this be done? The PUT method for creating a rule requires the use of application/octet-stream rather than JSON like creating a pool.

When I do a GET request on a rule that I've already created this is the response:

"#CQualifier:Any;\n#Param:HTTP Header;Op:contains;Expr:THEURLTOMATCH;Arg0:host;\n#Type:Choose Pool;Arg0:THE POOL NAME;\n\nif( string.contains( http.getheader( \"host\" ), \"THEURLTOMATCH\" ) ){\n\n\tpool.use( \"THE POOL NAME\" );\n\n}\n"

Any help is appreciated. Thanks!

6 REPLIES 6
Community Manager

Re: VTM 17.4 Rest API Rule Creation

Can you confirm if you created this rule originally using Rulebuilder? That may be what is going on here. If you create the rule using TrafficScript, then you should be able to see the rule more clearly using the REST API.

 

If you originally created the rule using RuleBuilder, then you can convert your rule to TrafficScript. On the GUI, you may have the option Preview Rule as TrafficScript to see what the TrafficScript rule would look like, and use the Convert Rule button to convert your rule permanently. The TrafficScript language gives you much more flexibility for building policies. 

 

 

New Contributor

Re: VTM 17.4 Rest API Rule Creation

The rules I get were created in the UI of the vTM. 

I was told by someone at Pulse secure through a case that you can't configure rules through the Rest API, which is quite disappointing. What's interesting is that I can use that format to create a string and send a PUT request with an application/octet-stream and it actually populates about half of the necessary fields, but I can't get it to do all of them. Oh well I guess. 

Community Manager

Re: VTM 17.4 Rest API Rule Creation

It may be that you do not have TrafficScript enabled - with the full configuration, you can create rules using the RuleBuilder (drop-down If/then etc)

 

You can also create rules in TrafficScript, which lets you type in full text-based rules, which are more powerful than the simple GUI system.

 

This article touches all three:

https://community.pulsesecure.net/t5/Pulse-vADC-Updates/Control-and-Flexibility-with-Stingray-Traffi...

 

More details on TrafficScript itself

https://community.pulsesecure.net/t5/Pulse-Secure-vADC/Collected-Tech-Tips-TrafficScript-examples/ta...

 

Community Manager

Re: VTM 17.4 Rest API Rule Creation

Here's an example screenshot using a browser to query the REST API:

 

REST-API.png

New Contributor

Re: VTM 17.4 Rest API Rule Creation

I've used the API to get a rules configuration, no problem. I'm having trouble creating one and congfiguring it. 

How do I enable Trafficscript?

Community Manager

Re: VTM 17.4 Rest API Rule Creation

Here's a link to a summary of the features in the "Advanced" and "Enterprise" editions of Pulse Traffic Manager, hope this helps to explain. The same feature matrix is common to both fixed-sized licenses using Pulse vTM, and in the capacity-based licensing scheme using Pulse Services Director:

 

As you can see, TrafficScript is available in the "Advanced" and "Enterprise" feature levels:

https://community.pulsesecure.net/t5/Pulse-Secure-vADC/Pulse-Virtual-Traffic-Manager-Feature-Summary...