Provisioning API – IP Filtering


Overview

The SearchStax Managed Search service provides an API supporting the creation, deletion and management of Solr deployments.

Platinum and Platinum Plus Clients Only!

The SearchStax API suite is available to our Platinum and Platinum Plus clients only, as noted on our Pricing page.

This page describes how to set up IP Filtering using the API methods.

The API can be accessed through any tool that assembles HTTP requests and dispatch them to a server. Among these would be the Python coreapi package, the Postman tool, and cURL. For Windows, use PowerShell 7+.

Account Owner, Admin, or Technical Contact

To run the SearchStax Provisioning API, you must be the account Owner, an account Admin, or a Technical Contact. See SearchStax User Roles.

Symbols enclosed in carets (< and >) such as <username> are metavariables. Substitute your local values when you encounter them in the examples.

Contents:

Related Pages:

IP Filtering

The SearchStax Provisioning API includes methods for applying IP Filters to deployments.

account > deployment > ip-filter > list

This method returns a list of IP Filters from a deployment.

GET /api/rest/v2/account/<account_name>/deployment/<uid>/ip-filter/?page=<n>

where <account_name> is the name of the tenant account, and <uid> is the ID of the deployment. The query parameter page is a number, <n>, that defaults to 1.

This method uses either Token authentication or API Key authentication.

There is no request body.

When invoked from Linux (Bash script):

curl --request GET "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/ip-filter/?page=<n>" \
  --header "Authorization: Token <token>" 

When invoked from Windows (PowerShell script):

$ACCOUNT = "AccountName"
$uid = "ss123456"

$RESULTS = Invoke-RestMethod -Method Get -Headers $headers `
          -uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/ip-filter/?page=1" 
$RESULTS = $RESULTS | ConvertTo-Json

The response is a JSON document containing a list of IP Filters.

[
  {
    "services": [
      "solr"
    ],
    "cidr_ip": "0.0.0.0/0",
    "description": ""
  }
]

account > deployment > ip-filter > add-cidr-ip

Setting IP Filters on Azure Deployments

When using add-cidr-ip in an Azure environment, IP filters for Zookeeper and Solr must both be explicitly set.

SearchStax requires Zookeeper to be locked down by IP filters. To then leave Solr open to any connection (a common request), set the Solr IP filter to ‘0.0.0.0/0’.

This method adds a new IP Filter to a deployment.

POST https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/ip-filter/add-cidr-ip/

where <account_name> is the name of the tenant account, and <uid> is the ID of the deployment.

This method uses either Token authentication or API Key authentication.

The request body should be a “application/json” encoded object, containing the following items:

{
    services=@('solr','zk')
    cidr_ip='100.100.100.100'
    description='Added by API'
}

Parameter Description Example
services
required
list of strings
Which services to apply the filter to. Allowed values are ‘solr’ and ‘zk’. (‘solr’,’zk’)
cidr_ip
required
string
The IP address. “100.100.100.100”
description
optional
string
A very brief label. “Added by API”

When invoked from Linux (Bash script):

curl --request POST "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/ip-filter/add-cidr-ip/" \
  --header "Content-Type: application/json" \
  --header "Authorization: Token <token>" \
  --data '{"services":["solr","zk"],"cidr_ip":"100.100.100.100","description":"Added by API"}'

When invoked from Windows (PowerShell script):

$ACCOUNT = "AccountName"
$uid = "ss123456"

$body = @{
    services=@('solr','zk')
    cidr_ip='100.100.100.100'
    description='Added by PowerShell'
}
$body = $body | ConvertTo-Json

$RESULT = Invoke-RestMethod -Method Post -body $body -ContentType 'application/json' -Headers $headers `
         -uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/ip-filter/add-cidr-ip/" 
$RESULT = $RESULT | ConvertTo-Json

The response is a JSON document confirming success.

{
  "detail": null,
  "success": true
}


account > deployment > ip-filter > delete-cidr-ip

This method deletes an IP Filter from a deployment.

POST https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/ip-filter/delete-cidr-ip/

where <account_name> is the name of the tenant account, and <uid> is the ID of the deployment.

This method uses either Token authentication or API Key authentication.

The request body should be a “application/json” encoded object, containing the following items:

{
    cidr_ip='100.100.100.100'
}

Parameter Description Example
cidr_ip
required
string
The IP address of the filter to delete. “100.100.100.100”

When invoked from Linux (Bash script):

curl --request POST "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/ip-filter/delete-cidr-ip/" \
  --header "Content-Type: application/json" \
  --header "Authorization: Token <token>" \
  --data '{"cidr_ip":"100.100.100.100"}'

When invoked from Windows (PowerShell script):

$ACCOUNT = "AccountName"
$uid = "ss123456"

$body = @{
    cidr_ip='100.100.100.100'
}
$body = $body | ConvertTo-Json

$RESULT = Invoke-RestMethod -Method Post -body $body -ContentType 'application/json' -Headers $headers `
         -uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/ip-filter/delete-cidr-ip/" 
$RESULT = $RESULT | ConvertTo-Json

The response is a JSON document confirming success.

{
  "detail": null,
  "success": true
}


account > deployment > ip-filter > update-cidr-ip

This method updates an IP Filter in a deployment.

POST https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/ip-filter/update-cidr-ip/

where <account_name> is the name of the tenant account, and <uid> is the ID of the deployment.

This method uses either Token authentication or API Key authentication.

The request body should be a “application/json” encoded object, containing the following items:

{
    services=@('solr','zk')
    cidr_ip='100.100.100.100'
    description='Updated by API'
}

Parameter Description Example
services
required
list of strings
Which services to apply the filter to. Allowed values are ‘solr’ and ‘zk’. (‘solr’,’zk’)
cidr_ip
required
string
The IP address. “100.100.100.100”
description
optional
string
A very brief label. “Added by API”

When invoked from Linux (Bash script):

curl --request POST "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/ip-filter/add-cidr-ip/" \
  --header "Content-Type: application/json" \
  --header "Authorization: Token <token>" \
  --data '{"services":["solr","zk"],"cidr_ip":"100.100.100.100","description":"Updated by API"}'

When invoked from Windows (PowerShell script):

$ACCOUNT = "AccountName"
$uid = "ss123456"

$body = @{
    services=@('solr','zk')
    cidr_ip='100.100.100.100'
    description='Updated by PowerShell'
}
$body = $body | ConvertTo-Json

$RESULT = Invoke-RestMethod -Method Post -body $body -ContentType 'application/json' -Headers $headers `
         -uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/ip-filter/update-cidr-ip/" 
$RESULT = $RESULT | ConvertTo-Json

The response is a JSON document confirming success.

{
  "detail": null,
  "success": true
}


Questions?

Do not hesitate to contact the SearchStax Support Desk.