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 Python - addpool
The following code uses Stingray's RESTful API to add a pool. The code is written in Python. This program creates a new pool, "pytest", 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 need to create a pool. In this case the program creates a properties dictionary with just one node. All other values will get default values when Stingray creates the pool.
This code was tested with Python 2.7.3 and version 1.1.0 of the requests library.
Run the Python script as follows:
Pool pytest added
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.