Skip to content

Latest commit

 

History

History
executable file
·
190 lines (132 loc) · 6.17 KB

File metadata and controls

executable file
·
190 lines (132 loc) · 6.17 KB

manticoresearch.UtilsApi

All URIs are relative to http://127.0.0.1:9308

Method HTTP request Description
sql POST /sql Perform SQL requests
token POST /token Create or rotate a bearer token

sql

SqlResponse sql(body, raw_response=raw_response)

Perform SQL requests

Run a query in SQL format. Expects a query string passed through body parameter and optional raw_response parameter that defines a format of response. raw_response can be set to False for Select queries only, e.g., SELECT * FROM mytable The query string must stay as it is, no URL encoding is needed. The response object depends on the query executed. In select mode the response has same format as /search operation.

Example

  • Basic Authentication (basicAuth):
  • Bearer Authentication (bearerAuth):
import manticoresearch
from manticoresearch.models.sql_response import SqlResponse
from manticoresearch.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://127.0.0.1:9308
# See configuration.py for a list of all supported configuration parameters.
configuration = manticoresearch.Configuration(
    host = "http://127.0.0.1:9308"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration = manticoresearch.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Configure Bearer authorization: bearerAuth
configuration = manticoresearch.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
async with manticoresearch.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = manticoresearch.UtilsApi(api_client)
    body = SHOW TABLES # str | A query parameter string. 
    raw_response = True # bool | Optional parameter, defines a format of response. Can be set to `False` for Select only queries and set to `True` for any type of queries. Default value is 'True'.  (optional) (default to True)

    try:
        # Perform SQL requests
        api_response = await api_instance.sql(body, raw_response=raw_response)
        print("The response of UtilsApi->sql:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling UtilsApi->sql: %s\n" % e)

Parameters

Name Type Description Notes
body str A query parameter string.
raw_response bool Optional parameter, defines a format of response. Can be set to `False` for Select only queries and set to `True` for any type of queries. Default value is 'True'. [optional] [default to True]

Return type

SqlResponse

Authorization

basicAuth, bearerAuth

HTTP request headers

  • Content-Type: text/plain
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 In case of SELECT-only in mode none the response schema is the same as of `search`. In case of `mode=raw` or `raw_response=true` the response depends on the query executed. -
0 error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

token

str token(body)

Create or rotate a bearer token

Create or rotate a bearer token for the authenticated HTTP user. Requires HTTP Basic authentication with a Manticore user name and password. The endpoint returns the raw token. Example:

curl -u admin:password -X POST http://127.0.0.1:9308/token -d "{}"

Example

  • Basic Authentication (basicAuth):
import manticoresearch
from manticoresearch.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://127.0.0.1:9308
# See configuration.py for a list of all supported configuration parameters.
configuration = manticoresearch.Configuration(
    host = "http://127.0.0.1:9308"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration = manticoresearch.Configuration(
    username = os.environ["USERNAME"],
    password = os.environ["PASSWORD"]
)

# Enter a context with an instance of the API client
async with manticoresearch.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = manticoresearch.UtilsApi(api_client)
    body = {} # object | 

    try:
        # Create or rotate a bearer token
        api_response = await api_instance.token(body)
        print("The response of UtilsApi->token:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling UtilsApi->token: %s\n" % e)

Parameters

Name Type Description Notes
body object

Return type

str

Authorization

basicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, text/plain

HTTP response details

Status code Description Response headers
200 Bearer token created or rotated successfully -
401 Missing or invalid credentials -
0 error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]