public class APIClient extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
APIClient.IndexQuery |
static class |
APIClient.LogType |
| Constructor and Description |
|---|
APIClient(String applicationID,
String apiKey)
Algolia Search initialization
|
APIClient(String applicationID,
String apiKey,
List<String> hostsArray)
Algolia Search initialization
|
APIClient(String applicationID,
String apiKey,
List<String> buildHostsArray,
List<String> queryHostsArray)
Algolia Search initialization
|
| Modifier and Type | Method and Description |
|---|---|
org.json.JSONObject |
addApiKey(org.json.JSONObject params)
Create a new api key
|
org.json.JSONObject |
addApiKey(org.json.JSONObject params,
RequestOptions requestOptions)
Create a new api key
|
org.json.JSONObject |
addApiKey(List<String> acls)
Create a new api key
|
org.json.JSONObject |
addApiKey(List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery)
Create a new api key
|
org.json.JSONObject |
addApiKey(List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery,
List<String> indexes)
Create a new user key
|
org.json.JSONObject |
addApiKey(List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery,
List<String> indexes,
RequestOptions requestOptions)
Create a new user key
|
org.json.JSONObject |
addApiKey(List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery,
RequestOptions requestOptions)
Create a new api key
|
org.json.JSONObject |
addApiKey(List<String> acls,
RequestOptions requestOptions)
Create a new api key
|
org.json.JSONObject |
addUserKey(org.json.JSONObject params)
Deprecated.
|
org.json.JSONObject |
addUserKey(List<String> acls)
Deprecated.
|
org.json.JSONObject |
addUserKey(List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery)
Deprecated.
|
org.json.JSONObject |
addUserKey(List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery,
List<String> indexes)
Deprecated.
|
org.json.JSONObject |
batch(org.json.JSONArray actions)
Custom batch
|
org.json.JSONObject |
batch(org.json.JSONArray actions,
RequestOptions requestOptions)
Custom batch
|
org.json.JSONObject |
batch(List<org.json.JSONObject> actions)
Custom batch
|
org.json.JSONObject |
batch(List<org.json.JSONObject> actions,
RequestOptions requestOptions)
Custom batch
|
org.json.JSONObject |
copyIndex(String srcIndexName,
String dstIndexName)
Copy an existing index.
|
org.json.JSONObject |
copyIndex(String srcIndexName,
String dstIndexName,
List<String> scopes)
Copy an existing index.
|
org.json.JSONObject |
copyIndex(String srcIndexName,
String dstIndexName,
List<String> scopes,
RequestOptions requestOptions)
Copy an existing index.
|
org.json.JSONObject |
copyIndex(String srcIndexName,
String dstIndexName,
RequestOptions requestOptions)
Copy an existing index.
|
org.json.JSONObject |
deleteApiKey(String key)
Delete an existing api key
|
org.json.JSONObject |
deleteApiKey(String key,
RequestOptions requestOptions)
Delete an existing api key
|
org.json.JSONObject |
deleteIndex(String indexName)
Delete an index
|
org.json.JSONObject |
deleteIndex(String indexName,
RequestOptions requestOptions)
Delete an index
|
protected org.json.JSONObject |
deleteRequest(String url,
RequestOptions requestOptions) |
org.json.JSONObject |
deleteUserKey(String key)
Deprecated.
|
void |
disableRateLimitForward()
Disable IP rate limit enabled with enableRateLimitForward() function
|
void |
enableRateLimitForward(String adminAPIKey,
String endUserIP,
String rateLimitAPIKey)
Allow to use IP rate limit when you have a proxy between end-user and Algolia.
|
String |
generateSecuredApiKey(String privateApiKey,
Query query)
Generate a secured and public API Key from a query and an
optional user token identifying the current user
|
String |
generateSecuredApiKey(String privateApiKey,
Query query,
String userToken)
Generate a secured and public API Key from a query and an
optional user token identifying the current user
|
String |
generateSecuredApiKey(String privateApiKey,
String tagFilters)
Deprecated.
Use `generateSecuredApiKey(String privateApiKey, Query query)` version
|
String |
generateSecuredApiKey(String privateApiKey,
String tagFilters,
String userToken)
Deprecated.
Use `generateSecuredApiKey(String privateApiKey, Query query, String userToken)` version
|
org.json.JSONObject |
getApiKey(String key)
Get an api key
|
org.json.JSONObject |
getApiKey(String key,
RequestOptions requestOptions)
Get an api key
|
org.json.JSONObject |
getLogs()
Return 10 last log entries.
|
org.json.JSONObject |
getLogs(int offset,
int length)
Return last logs entries.
|
org.json.JSONObject |
getLogs(int offset,
int length,
APIClient.LogType logType)
Return last logs entries.
|
org.json.JSONObject |
getLogs(int offset,
int length,
APIClient.LogType logType,
RequestOptions requestOptions)
Return last logs entries.
|
org.json.JSONObject |
getLogs(int offset,
int length,
boolean onlyErrors)
Return last logs entries.
|
org.json.JSONObject |
getLogs(int offset,
int length,
boolean onlyErrors,
RequestOptions requestOptions)
Return last logs entries.
|
org.json.JSONObject |
getLogs(int offset,
int length,
RequestOptions requestOptions)
Return last logs entries.
|
org.json.JSONObject |
getLogs(RequestOptions requestOptions)
Return 10 last log entries.
|
protected org.json.JSONObject |
getRequest(String url,
boolean search,
RequestOptions requestOptions) |
org.json.JSONObject |
getUserKeyACL(String key)
Deprecated.
|
Index |
initIndex(String indexName)
Get the index object initialized (no server call needed for initialization)
|
org.json.JSONObject |
listApiKeys()
List all existing api keys with their associated ACLs
|
org.json.JSONObject |
listApiKeys(RequestOptions requestOptions)
List all existing api keys with their associated ACLs
|
org.json.JSONObject |
listIndexes()
List all existing indexes
return an JSON Object in the form:
{ "items": [ {"name": "contacts", "createdAt": "2013-01-18T15:33:13.556Z"},
{"name": "notes", "createdAt": "2013-01-18T15:33:13.556Z"}]}
|
org.json.JSONObject |
listIndexes(RequestOptions requestOptions)
List all existing indexes
return an JSON Object in the form:
{ "items": [ {"name": "contacts", "createdAt": "2013-01-18T15:33:13.556Z"},
{"name": "notes", "createdAt": "2013-01-18T15:33:13.556Z"}]}
|
org.json.JSONObject |
listUserKeys()
Deprecated.
|
org.json.JSONObject |
moveIndex(String srcIndexName,
String dstIndexName)
Move an existing index.
|
org.json.JSONObject |
moveIndex(String srcIndexName,
String dstIndexName,
RequestOptions requestOptions)
Move an existing index.
|
org.json.JSONObject |
multipleQueries(List<APIClient.IndexQuery> queries)
This method allows to query multiple indexes with one API call
|
org.json.JSONObject |
multipleQueries(List<APIClient.IndexQuery> queries,
RequestOptions requestOptions)
This method allows to query multiple indexes with one API call
|
org.json.JSONObject |
multipleQueries(List<APIClient.IndexQuery> queries,
String strategy,
RequestOptions requestOptions) |
protected org.json.JSONObject |
postRequest(String url,
String obj,
boolean build,
boolean search,
RequestOptions requestOptions) |
protected org.json.JSONObject |
putRequest(String url,
String obj,
RequestOptions requestOptions) |
void |
setExtraHeader(String key,
String value)
Allow to set custom headers
|
void |
setHostDownTimeoutMS(int hostDownTimeoutMS)
Allow to set the timeout for a down host
|
void |
setTimeout(int connectTimeout,
int readTimeout)
Allow to set the timeout
|
void |
setUserAgent(String agent,
String agentVersion)
Allow to modify the user-agent in order to add the user agent of the integration
|
org.json.JSONObject |
updateApiKey(String key,
org.json.JSONObject params)
Update an api key
|
org.json.JSONObject |
updateApiKey(String key,
org.json.JSONObject params,
RequestOptions requestOptions)
Update an api key
|
org.json.JSONObject |
updateApiKey(String key,
List<String> acls)
Update an api key
|
org.json.JSONObject |
updateApiKey(String key,
List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery)
Update an api key
|
org.json.JSONObject |
updateApiKey(String key,
List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery,
List<String> indexes)
Update an api key
|
org.json.JSONObject |
updateApiKey(String key,
List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery,
List<String> indexes,
RequestOptions requestOptions)
Update an api key
|
org.json.JSONObject |
updateApiKey(String key,
List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery,
RequestOptions requestOptions)
Update an api key
|
org.json.JSONObject |
updateApiKey(String key,
List<String> acls,
RequestOptions requestOptions)
Update an api key
|
org.json.JSONObject |
updateUserKey(String key,
org.json.JSONObject params)
Deprecated.
|
org.json.JSONObject |
updateUserKey(String key,
List<String> acls)
Deprecated.
|
org.json.JSONObject |
updateUserKey(String key,
List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery)
Deprecated.
|
org.json.JSONObject |
updateUserKey(String key,
List<String> acls,
int validity,
int maxQueriesPerIPPerHour,
int maxHitsPerQuery,
List<String> indexes)
Deprecated.
|
public APIClient(String applicationID, String apiKey)
applicationID - the application ID you have in your admin interfaceapiKey - a valid API key for the servicepublic APIClient(String applicationID, String apiKey, List<String> hostsArray)
applicationID - the application ID you have in your admin interfaceapiKey - a valid API key for the servicehostsArray - the list of hosts that you have received for the servicepublic APIClient(String applicationID, String apiKey, List<String> buildHostsArray, List<String> queryHostsArray)
applicationID - the application ID you have in your admin interfaceapiKey - a valid API key for the servicebuildHostsArray - the list of hosts that you have received for the servicequeryHostsArray - the list of hosts that you have received for the servicepublic void setUserAgent(String agent, String agentVersion)
public void enableRateLimitForward(String adminAPIKey, String endUserIP, String rateLimitAPIKey)
adminAPIKey - the admin API Key you can find in your dashboardendUserIP - the end user IP (you can use both IPV4 or IPV6 syntax)rateLimitAPIKey - the API key on which you have a rate limitpublic void disableRateLimitForward()
public void setTimeout(int connectTimeout,
int readTimeout)
connectTimeout - connection timeout in MSreadTimeout - socket timeout in MSpublic void setHostDownTimeoutMS(int hostDownTimeoutMS)
hostDownTimeoutMS - host down timeout in MSpublic org.json.JSONObject listIndexes()
throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject listIndexes(RequestOptions requestOptions) throws AlgoliaException
requestOptions - Options to pass to this requestAlgoliaExceptionpublic org.json.JSONObject deleteIndex(String indexName) throws AlgoliaException
indexName - the name of index to delete
return an object containing a "deletedAt" attributeAlgoliaExceptionpublic org.json.JSONObject deleteIndex(String indexName, RequestOptions requestOptions) throws AlgoliaException
indexName - the name of index to delete
return an object containing a "deletedAt" attributerequestOptions - Options to pass to this requestAlgoliaExceptionpublic org.json.JSONObject moveIndex(String srcIndexName, String dstIndexName) throws AlgoliaException
srcIndexName - the name of index to copy.dstIndexName - the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).AlgoliaExceptionpublic org.json.JSONObject moveIndex(String srcIndexName, String dstIndexName, RequestOptions requestOptions) throws AlgoliaException
srcIndexName - the name of index to copy.dstIndexName - the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).requestOptions - Options to pass to this requestAlgoliaExceptionpublic org.json.JSONObject copyIndex(String srcIndexName, String dstIndexName) throws AlgoliaException
srcIndexName - the name of index to copy.dstIndexName - the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).AlgoliaExceptionpublic org.json.JSONObject copyIndex(String srcIndexName, String dstIndexName, RequestOptions requestOptions) throws AlgoliaException
srcIndexName - the name of index to copy.dstIndexName - the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).requestOptions - Options to pass to this requestAlgoliaExceptionpublic org.json.JSONObject copyIndex(String srcIndexName, String dstIndexName, List<String> scopes) throws AlgoliaException
srcIndexName - the name of index to copy.dstIndexName - the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).scopes - the list of scopes to copyAlgoliaExceptionpublic org.json.JSONObject copyIndex(String srcIndexName, String dstIndexName, List<String> scopes, RequestOptions requestOptions) throws AlgoliaException
srcIndexName - the name of index to copy.dstIndexName - the new index name that will contains a copy of srcIndexName (destination will be overriten if it already exist).scopes - the list of scopes to copyrequestOptions - Options to pass to this requestAlgoliaExceptionpublic org.json.JSONObject getLogs()
throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject getLogs(RequestOptions requestOptions) throws AlgoliaException
requestOptions - Options to pass to this requestAlgoliaExceptionpublic org.json.JSONObject getLogs(int offset,
int length)
throws AlgoliaException
offset - Specify the first entry to retrieve (0-based, 0 is the most recent log entry).length - Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000.AlgoliaExceptionpublic org.json.JSONObject getLogs(int offset,
int length,
RequestOptions requestOptions)
throws AlgoliaException
offset - Specify the first entry to retrieve (0-based, 0 is the most recent log entry).length - Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000.requestOptions - Options to pass to this requestAlgoliaExceptionpublic org.json.JSONObject getLogs(int offset,
int length,
boolean onlyErrors)
throws AlgoliaException
offset - Specify the first entry to retrieve (0-based, 0 is the most recent log entry).length - Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000.onlyErrors - Retrieve only logs with an httpCode different than 200 and 201AlgoliaExceptionpublic org.json.JSONObject getLogs(int offset,
int length,
boolean onlyErrors,
RequestOptions requestOptions)
throws AlgoliaException
offset - Specify the first entry to retrieve (0-based, 0 is the most recent log entry).length - Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000.onlyErrors - Retrieve only logs with an httpCode different than 200 and 201requestOptions - Options to pass to this requestAlgoliaExceptionpublic org.json.JSONObject getLogs(int offset,
int length,
APIClient.LogType logType)
throws AlgoliaException
offset - Specify the first entry to retrieve (0-based, 0 is the most recent log entry).length - Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000.logType - Specify the type of log to retrieveAlgoliaExceptionpublic org.json.JSONObject getLogs(int offset,
int length,
APIClient.LogType logType,
RequestOptions requestOptions)
throws AlgoliaException
offset - Specify the first entry to retrieve (0-based, 0 is the most recent log entry).length - Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000.logType - Specify the type of log to retrieverequestOptions - Options to pass to this requestAlgoliaExceptionpublic Index initIndex(String indexName)
indexName - the name of index@Deprecated public org.json.JSONObject listUserKeys() throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject listApiKeys()
throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject listApiKeys(RequestOptions requestOptions) throws AlgoliaException
requestOptions - Options to pass to this requestAlgoliaException@Deprecated public org.json.JSONObject getUserKeyACL(String key) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject getApiKey(String key) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject getApiKey(String key, RequestOptions requestOptions) throws AlgoliaException
requestOptions - Options to pass to this requestAlgoliaException@Deprecated public org.json.JSONObject deleteUserKey(String key) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject deleteApiKey(String key) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject deleteApiKey(String key, RequestOptions requestOptions) throws AlgoliaException
requestOptions - Options to pass to this requestAlgoliaException@Deprecated public org.json.JSONObject addUserKey(org.json.JSONObject params) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject addApiKey(org.json.JSONObject params)
throws AlgoliaException
params - the list of parameters for this key. Defined by a JSONObject that
can contains the following values:
- acl: array of string
- indices: array of string
- validity: int
- referers: array of string
- description: string
- maxHitsPerQuery: integer
- queryParameters: string
- maxQueriesPerIPPerHour: integerAlgoliaExceptionpublic org.json.JSONObject addApiKey(org.json.JSONObject params,
RequestOptions requestOptions)
throws AlgoliaException
params - the list of parameters for this key. Defined by a JSONObject that
can contains the following values:
- acl: array of string
- indices: array of string
- validity: int
- referers: array of string
- description: string
- maxHitsPerQuery: integer
- queryParameters: string
- maxQueriesPerIPPerHour: integerrequestOptions - Options to pass to this requestAlgoliaException@Deprecated public org.json.JSONObject addUserKey(List<String> acls) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject addApiKey(List<String> acls) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)AlgoliaExceptionpublic org.json.JSONObject addApiKey(List<String> acls, RequestOptions requestOptions) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)requestOptions - Options to pass to this requestAlgoliaException@Deprecated public org.json.JSONObject updateUserKey(String key, org.json.JSONObject params) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject updateApiKey(String key, org.json.JSONObject params) throws AlgoliaException
params - the list of parameters for this key. Defined by a JSONObject that
can contains the following values:
- acl: array of string
- indices: array of string
- validity: int
- referers: array of string
- description: string
- maxHitsPerQuery: integer
- queryParameters: string
- maxQueriesPerIPPerHour: integerAlgoliaExceptionpublic org.json.JSONObject updateApiKey(String key, org.json.JSONObject params, RequestOptions requestOptions) throws AlgoliaException
params - the list of parameters for this key. Defined by a JSONObject that
can contains the following values:
- acl: array of string
- indices: array of string
- validity: int
- referers: array of string
- description: string
- maxHitsPerQuery: integer
- queryParameters: string
- maxQueriesPerIPPerHour: integerrequestOptions - Options to pass to this requestAlgoliaException@Deprecated public org.json.JSONObject updateUserKey(String key, List<String> acls) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject updateApiKey(String key, List<String> acls) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)AlgoliaExceptionpublic org.json.JSONObject updateApiKey(String key, List<String> acls, RequestOptions requestOptions) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)requestOptions - Options to pass to this requestAlgoliaException@Deprecated public org.json.JSONObject addUserKey(List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject addApiKey(List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)validity - the number of seconds after which the key will be automatically removed (0 means no time limit for this key)maxQueriesPerIPPerHour - Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit).maxHitsPerQuery - Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited)AlgoliaExceptionpublic org.json.JSONObject addApiKey(List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, RequestOptions requestOptions) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)validity - the number of seconds after which the key will be automatically removed (0 means no time limit for this key)maxQueriesPerIPPerHour - Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit).maxHitsPerQuery - Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited)requestOptions - Options to pass to this requestAlgoliaException@Deprecated public org.json.JSONObject updateUserKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject updateApiKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)validity - the number of seconds after which the key will be automatically removed (0 means no time limit for this key)maxQueriesPerIPPerHour - Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit).maxHitsPerQuery - Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited)AlgoliaExceptionpublic org.json.JSONObject updateApiKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, RequestOptions requestOptions) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)validity - the number of seconds after which the key will be automatically removed (0 means no time limit for this key)maxQueriesPerIPPerHour - Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit).maxHitsPerQuery - Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited)requestOptions - Options to pass to this requestAlgoliaException@Deprecated public org.json.JSONObject addUserKey(List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, List<String> indexes) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject addApiKey(List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, List<String> indexes) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)validity - the number of seconds after which the key will be automatically removed (0 means no time limit for this key)maxQueriesPerIPPerHour - Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit).maxHitsPerQuery - Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited)indexes - the list of targeted indexesAlgoliaExceptionpublic org.json.JSONObject addApiKey(List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, List<String> indexes, RequestOptions requestOptions) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)validity - the number of seconds after which the key will be automatically removed (0 means no time limit for this key)maxQueriesPerIPPerHour - Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit).maxHitsPerQuery - Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited)indexes - the list of targeted indexesrequestOptions - Options to pass to this requestAlgoliaException@Deprecated public org.json.JSONObject updateUserKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, List<String> indexes) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject updateApiKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, List<String> indexes) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)validity - the number of seconds after which the key will be automatically removed (0 means no time limit for this key)maxQueriesPerIPPerHour - Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit).maxHitsPerQuery - Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited)indexes - the list of targeted indexesAlgoliaExceptionpublic org.json.JSONObject updateApiKey(String key, List<String> acls, int validity, int maxQueriesPerIPPerHour, int maxHitsPerQuery, List<String> indexes, RequestOptions requestOptions) throws AlgoliaException
acls - the list of ACL for this key. Defined by an array of strings that
can contains the following values:
- search: allow to search (https and http)
- addObject: allows to add/update an object in the index (https only)
- deleteObject : allows to delete an existing object (https only)
- deleteIndex : allows to delete index content (https only)
- settings : allows to get index settings (https only)
- editSettings : allows to change index settings (https only)validity - the number of seconds after which the key will be automatically removed (0 means no time limit for this key)maxQueriesPerIPPerHour - Specify the maximum number of API calls allowed from an IP address per hour. Defaults to 0 (no rate limit).maxHitsPerQuery - Specify the maximum number of hits this API key can retrieve in one call. Defaults to 0 (unlimited)indexes - the list of targeted indexesrequestOptions - Options to pass to this requestAlgoliaException@Deprecated public String generateSecuredApiKey(String privateApiKey, String tagFilters) throws NoSuchAlgorithmException, InvalidKeyException
privateApiKey - your private API KeytagFilters - the list of tags applied to the query (used as security)NoSuchAlgorithmExceptionInvalidKeyExceptionpublic String generateSecuredApiKey(String privateApiKey, Query query) throws NoSuchAlgorithmException, InvalidKeyException
privateApiKey - your private API Keyquery - contains the parameter applied to the query (used as security)NoSuchAlgorithmExceptionInvalidKeyException@Deprecated public String generateSecuredApiKey(String privateApiKey, String tagFilters, String userToken) throws NoSuchAlgorithmException, InvalidKeyException, AlgoliaException
privateApiKey - your private API KeytagFilters - the list of tags applied to the query (used as security)userToken - an optional token identifying the current userNoSuchAlgorithmExceptionInvalidKeyExceptionAlgoliaExceptionpublic String generateSecuredApiKey(String privateApiKey, Query query, String userToken) throws NoSuchAlgorithmException, InvalidKeyException
privateApiKey - your private API Keyquery - contains the parameter applied to the query (used as security)userToken - an optional token identifying the current userNoSuchAlgorithmExceptionInvalidKeyExceptionprotected org.json.JSONObject getRequest(String url, boolean search, RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionprotected org.json.JSONObject deleteRequest(String url, RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionprotected org.json.JSONObject postRequest(String url, String obj, boolean build, boolean search, RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionprotected org.json.JSONObject putRequest(String url, String obj, RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject multipleQueries(List<APIClient.IndexQuery> queries) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject multipleQueries(List<APIClient.IndexQuery> queries, RequestOptions requestOptions) throws AlgoliaException
requestOptions - Options to pass to this requestAlgoliaExceptionpublic org.json.JSONObject multipleQueries(List<APIClient.IndexQuery> queries, String strategy, RequestOptions requestOptions) throws AlgoliaException
AlgoliaExceptionpublic org.json.JSONObject batch(org.json.JSONArray actions)
throws AlgoliaException
actions - the array of actionsAlgoliaExceptionpublic org.json.JSONObject batch(org.json.JSONArray actions,
RequestOptions requestOptions)
throws AlgoliaException
actions - the array of actionsrequestOptions - Options to pass to this requestAlgoliaExceptionpublic org.json.JSONObject batch(List<org.json.JSONObject> actions) throws AlgoliaException
actions - the array of actionsAlgoliaExceptionpublic org.json.JSONObject batch(List<org.json.JSONObject> actions, RequestOptions requestOptions) throws AlgoliaException
actions - the array of actionsrequestOptions - Options to pass to this requestAlgoliaExceptionCopyright © 2019. All rights reserved.