Package com.nettoolkit.gatekeeper
Class CountVisitsRequest
java.lang.Object
com.nettoolkit.internal.request.BaseApiRequest
com.nettoolkit.internal.request.GetRequest
com.nettoolkit.gatekeeper.CountVisitsRequest
Request to count visits. Corresponds to endpoint
GET /v1/gatekeeper/visits/count.
EXPERIMENTAL: This route is not guaranteed to have stable performance yet. The API is also subject to change, based on supportable queries.
Sample 1:
// Count number of visits from IP address 1.2.3.4 that were denied.
int numVisits = gatekeeperClient.newCountVisitsRequest()
.ip("1.2.3.4")
.authorization("deny")
.send();
Sample 2:
// Count number of visits from Google crawler in the past 30 days.
int numVisits = gatekeeperClient.newCountVisitsRequest()
.tag("Google crawler")
.earliest(OffsetDateTime.now().minusDays(30))
.send();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthorization(String strAuthorization) Sets the authorization to query.Sets the country to query.earliest(long lTimestamp) Sets the earliest time to query.Sets the earliest time to query.earliest(OffsetDateTime timestamp) Sets the earliest time to query.protected StringgetPath()Sets the IP address to query.latest(long lTimestamp) Sets the latest time to query.Sets the latest time to query.latest(OffsetDateTime timestamp) Sets the latest time to query.pagePrefix(String strPagePrefix) Sets the page prefix to query.intsend()Sends the request.Sets the tag to query.userId(long lUserId) Sets the user ID to query.Methods inherited from class com.nettoolkit.internal.request.GetRequest
getHttpMethod, serializeParametersMethods inherited from class com.nettoolkit.internal.request.BaseApiRequest
getClient, getParameters, newHttpRequestBuilder, toHttpRequest, toString
-
Constructor Details
-
CountVisitsRequest
-
-
Method Details
-
getPath
- Specified by:
getPathin classBaseApiRequest
-
ip
Sets the IP address to query. Expects dot notation for IPv4 and hexadecimal for IPv6.- Parameters:
strIpAddress- the IP address in dot or hexadecimal format- Returns:
- this
-
userId
Sets the user ID to query.- Parameters:
lUserId- the user ID- Returns:
- this
-
tag
Sets the tag to query. See the supported tags page for available options.- Parameters:
strTag- the tag name- Returns:
- this
-
country
Sets the country to query. Expects either a ISO 3166 alpha-2 country code (e.g. "US", "JP") or a full country name (e.g. "United States", "Japan"). For a full list of supported values, see the IANA Language Subtag Registry and search for "Type: region".- Parameters:
strCountry- the country name or country code- Returns:
- this
-
pagePrefix
Sets the page prefix to query. The page is everything in the URL from the first "/" onward (e.g. in "https://www.example.com/index.html?a=b", the page would be "/index.html?a=b"). The visit's page must start with the page prefix to be counted.- Parameters:
strPagePrefix- the page prefix- Returns:
- this
-
authorization
Sets the authorization to query. Valid authorizations include "allow", "deny", "captcha", and any custom authorizations. Only applicable to visits created by the visit authorization route.- Parameters:
strAuthorization- the authorization- Returns:
- this
-
earliest
Sets the earliest time to query. Visits before this time will not be counted.- Parameters:
timestamp- the earliest timestamp- Returns:
- this
-
earliest
Sets the earliest time to query. Visits before this time will not be counted.- Parameters:
timestamp- the earliest timestamp- Returns:
- this
-
earliest
Sets the earliest time to query. Visits before this time will not be counted.- Parameters:
lTimestamp- the earliest timestamp in epoch milliseconds- Returns:
- this
-
latest
Sets the latest time to query. Visits after this time will not be counted.- Parameters:
timestamp- the latest timestamp- Returns:
- this
-
latest
Sets the latest time to query. Visits after this time will not be counted.- Parameters:
timestamp- the latest timestamp- Returns:
- this
-
latest
Sets the latest time to query. Visits after this time will not be counted.- Parameters:
lTimestamp- the latest timestamp in epoch milliseconds- Returns:
- this
-
send
Sends the request.- Returns:
- the visit count for IP address as seen by policy
- Throws:
NetToolKitException
-