SearchStax Managed Solr API – Basic Auth


Overview

SearchStax® provides an API supporting the creation, deletion and management of SearchStax deployments.

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 Core 6.1+.

<div class="alert alert-warning">
<h3>Account Owner, Admin, or Technical Contact</h3>
<p>To run the SearchStax Provisioning API, you must be the account Owner,
an account Admin, or a Technical Contact. See <a href="../userroles/#userroles">SearchStax User Roles</a>.</p>
</div>

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/" <strong>\
</strong>  --header "Authorization: Token <token>" <strong>\
</strong>  --header "Content-Type: application/json" <strong>\
</strong>  --data "{
    <strong>\"</strong>username<strong>\"</strong> : <strong>\"</strong>demoSolrUser<strong>\"</strong>,
    <strong>\"</strong>password<strong>\"</strong> : <strong>\"</strong>test123<strong>\"</strong>,
    <strong>\"</strong>role<strong>\"</strong> : <strong>\"</strong>Admin<strong>\"</strong>
}"

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.

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

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"
}

ParameterDescriptionExample
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/" <strong>\
</strong>  --header "Authorization: APIkey <apikey>" <strong>\
</strong>  --header "Content-Type: application/json" <strong>\
</strong>  --data "{
    <strong>\"</strong>username<strong>\"</strong> : <strong>\"</strong>demoSolrUser<strong>\"</strong>,
    <strong>\"</strong>password<strong>\"</strong>: <strong>\"</strong>test456<strong>\"</strong>
}"

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

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

This method returns a JSON document containing a success message.

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"
}

ParameterDescriptionExample
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/" <strong>\
</strong>  --header "Authorization: APIkey <apikey>" <strong>\
</strong>  --header "Content-Type: application/json" <strong>\
</strong>  --data "{
    <strong>\"</strong>username<strong>\"</strong> : <strong>\"</strong>demoSolrUser<strong>\"</strong>,
    <strong>\"</strong>role<strong>\"</strong> : <strong>\"</strong>Read<strong>\"</strong>
}"

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.

Was this article helpful?
YesNo