Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Search instead for
Did you mean:
Tech Tip: Using the RESTful Control API with TrafficScript - addpool
The following code uses Stingray's RESTful API to add a pool. The code is written in TrafficScript. This rule creates a new pool, "tstest", first doing a GET to make sure the pool doesn't already exist, and if the pool doesn't exist, the pool is created by doing a PUT with just the minimum data needed to create a pool. In this case the rule creates a properties hash with just one node. All other values will get default values when Stingray creates the pool. Subroutines in stmrestclient are used to do the actual RESTful API calls. stmrestclient is attached to the article Tech Tip: Using the RESTful Control API with TrafficScript - Overview.
The only difference between doing a PUT to change a resource and a PUT to add a resource is the HTTP status code returned. When changing a resource, 200 is the expected status code and when adding a resource, 201 is the expected status code.