Provisioning API – Basic Auth


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 manage Solr Basic Auth features through the API.

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:

Solr Basic Auth

The SearchStax Provisioning API provides a selection of methods for managing Solr basic authentication from a remote application.

account > deployment > solr > auth > enable_basic_auth

This method enables basic auth for a Solr deployment.

GET https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/solr/auth/enable/

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.

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>/solr/auth/enable/" \
  --header "Authorization: APIkey <apikey>" 

When invoked from Windows (PowerShell script):

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

$RESULT = Invoke-RestMethod -Method Get -Headers $headers `
         -uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/solr/auth/enable/" 
$RESULT = $RESULT | ConvertTo-Json

This method returns a JSON document containing a success message.

{
  "message": "Basic authentication successfully Enabled for Solr",
  "success": "true"
}

account > deployment > solr > auth > disable_basic_auth

This method disables basic auth for a Solr deployment.

GET https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/solr/auth/disable/

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.

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>/solr/auth/disable/" \
  --header "Authorization: APIkey <apikey>" \

When invoked from Windows (PowerShell script):

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

$RESULT = Invoke-RestMethod -Method Get -Headers $headers `
         -uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/solr/auth/disable/" 
$RESULT = $RESULT | ConvertTo-Json

This method returns a JSON document containing a success message.

{
  "message": "Basic authentication successfully Disabled for Solr",
  "success": "true"
}

account > deployment > solr > auth > add_solr_user

This method adds a Solr user to the deployment. Basic auth must be enabled.

POST https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/solr/auth/add-user/

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:

{
    "username" : "demoSolrUser",
    "password" : "test123",
    "role" : "Admin"
}

ParameterDescriptionExample
username
required
string
This is the Solr user name.“demoSolrUser”
password
required
string
This is the Solr user’s password.“test123”
role
required
string
This is the Solr role: Admin, Read, Write, or ReadWrite.“Admin”

See Solr Basic Authentication for an explanation of the Solr roles.

When invoked from Linux (Bash script):

curl --request POST "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/solr/auth/add-user/" \
  --header "Authorization: Token <token>" \
  --header "Content-Type: application/json" \
  --data "{
    \"username\" : \"demoSolrUser\",
    \"password\" : \"test123\",
    \"role\" : \"Admin\"
}"

When invoked from Windows (PowerShell script):

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

$body = @{
    username='demoSolrUser'
    password='test123'
    role='Admin'
}

$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/solr/auth/add-user/" 
$RESULT = $RESULT | ConvertTo-Json

This method returns a JSON document containing a success message.

{
  "message": "User successfully added",
  "success": "true"
}

account > deployment > solr > auth > delete_solr_user

This method deletes a Solr user from a deployment.

POST https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/solr/auth/delete-user/

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:

{
    "username" : "demoSolrUser"
}

ParameterDescriptionExample
username
required
string
This is the Solr user name.“demoSolrUser”

When invoked from Linux (Bash script):

curl --request POST "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/solr/auth/delete-user/" \
  --header "Authorization: APIkey <apikey>" \
  --header "Content-Type: application/json" \
  --data "{
    \"username\" : \"demoSolrUser\"
}"

When invoked from Windows (PowerShell script):

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

$body = @{
    username='demoSolrUser'
}

$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/solr/auth/delete-user/" 
$RESULT = $RESULT | ConvertTo-Json

This method returns a JSON document containing a success message.

{
  "message": "User successfully deleted!",
  "success": "true"
}

account > deployment > solr > auth > get_solr_users

This method gets the Solr users for a deployment.

GET https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/solr/auth/get-users/

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.

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>/solr/auth/get-users/" \
  --header "Authorization: APIkey <apikey>" 

When invoked from Windows (PowerShell script):

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

$RESULT = Invoke-RestMethod -Method Get -Headers $headers `
         -uri "https://app.searchstax.com/api/rest/v2/account/$ACCOUNT/deployment/$uid/solr/auth/get-users/" 
$RESULT = $RESULT | ConvertTo-Json

The response is a JSON document containing the Solr users and the roles associated with them.

{
  "success": "true",
  "users": {
    "demoSolrUser": {
      "roles": [ "Read", "Write", "Admin" ]
    }
  }
}

account > deployment > solr > auth > set_solr_user_password

This method sets a password for a Solr user.

POST https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/solr/auth/set-password/

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:

{
    "username" : "demoSolrUser",
    "password": "test456"
}

Parameter Description Example
username
required
string
This is the Solr user name.“demoSolrUser”
password
required
string
This is the Solr user’s password.“test456”

When invoked from Linux (Bash script):

curl --request POST "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/solr/auth/set-password/" \
  --header "Authorization: APIkey <apikey>" \
  --header "Content-Type: application/json" \
  --data "{
    \"username\" : \"demoSolrUser\",
    \"password\": \"test456\"
}"

When invoked from Windows (PowerShell script):

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

$body = @{
    username='demoSolrUser'
    password='test456'
}

$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/solr/auth/set-password/" 
$RESULT = $RESULT | ConvertTo-Json

This method returns a JSON document containing a success message.

{
  "message": "Password successfully updated!",
  "success": "true"
}

account > deployment > solr > auth > set_solr_user_role

This method sets the Solr user’s role. Available roles are Admin, Read, Write, and ReadWrite.

POST https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/solr/auth/set-role/

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:

{
    "username" : "demoSolrUser",
    "role" : "Read"
}

Parameter Description Example
username
required
string
This is the Solr user name.“demoSolrUser”
role
required
string
This is the Solr role: Admin, Read, Write, or ReadWrite.“Read”

See Solr Basic Authentication for an explanation of the Solr roles.

When invoked from Linux (Bash script):

curl --request POST "https://app.searchstax.com/api/rest/v2/account/<account_name>/deployment/<uid>/solr/auth/set-role/" \
  --header "Authorization: APIkey <apikey>" \
  --header "Content-Type: application/json" \
  --data "{
    \"username\" : \"demoSolrUser\",
    \"role\" : \"Read\"
}"

When invoked from Windows (PowerShell script):

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

$body = @{
    username='demoSolrUser'
    role='Read'
}

$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/solr/auth/set-role/" 
$RESULT = $RESULT | ConvertTo-Json

This method returns a JSON document containing a success message.

{
  "message": "Successfully updated user role!",
  "success": "true"
}

Questions?

Do not hesitate to contact the SearchStax Support Desk.