Package com.nettoolkit.gatekeeper
Class AuthorizeVisitRequest
java.lang.Object
com.nettoolkit.internal.request.BaseApiRequest
com.nettoolkit.internal.request.PostRequest
com.nettoolkit.gatekeeper.AuthorizeVisitRequest
Request to authorize a visit. Corresponds to endpoint
POST /v1/gatekeeper/visits/authorization. IP address and URL are required; other fields are optional.
Sample:
Visit visit = gatekeeperClient.newAuthorizeVisitRequest()
.ip("1.2.3.4")
.url("https://example.com/hello")
.userAgent("SomeBot/1.0 (+http://somebot.com/about)")
.send();
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected HttpContentTypeprotected StringgetPath()Sets the visit IP address.record(boolean bShouldRecord) Sets whether to record the visit in the database.Sets the visit referrer.send()Sends the request.Sets the visitor session ID.Sets the visit URL.Sets the visitor user agent.Sets the visitor user ID.Methods inherited from class com.nettoolkit.internal.request.PostRequest
getHttpMethod, newHttpRequestBuilder, serializeParametersMethods inherited from class com.nettoolkit.internal.request.BaseApiRequest
getClient, getParameters, toHttpRequest, toString
-
Constructor Details
-
AuthorizeVisitRequest
-
-
Method Details
-
getContentType
- Specified by:
getContentTypein classPostRequest
-
getPath
- Specified by:
getPathin classBaseApiRequest
-
ip
Sets the visit IP address. Expects dot notation for IPv4 and hexadecimal for IPv6. required- Parameters:
strIpAddress- the IP address in dot or hexadecimal format- Returns:
- this
-
url
Sets the visit URL. Best practice is to set full URL for request, but use cases may vary. Format is not strictly enforced. required- Parameters:
strUrl- the URL- Returns:
- this
-
userAgent
Sets the visitor user agent. User agent can typically be found in the "User-Agent" HTTP header.- Parameters:
strUserAgent- the user agent string- Returns:
- this
-
referrer
Sets the visit referrer. Referrer can typically be found in the "Referer" (famously misspelled) HTTP header.- Parameters:
strReferrer- the referrer- Returns:
- this
-
sessionId
Sets the visitor session ID. Finding session ID may depend on server implementation. For Java's HttpSession, you can get it from thegetIdmethod.- Parameters:
strSessionId- the session ID- Returns:
- this
-
userId
Sets the visitor user ID. Finding user ID will depend entirely on your application's structure.- Parameters:
lUserId- the user ID number- Returns:
- this
-
record
Sets whether to record the visit in the database. Unrecorded visits will not affect visit counts. Visits are recorded by default.- Parameters:
bShouldRecord-trueto save visit (default),falseto not save visit- Returns:
- this
-
send
Sends the request.- Returns:
- a visit object containing authorization information
- Throws:
NetToolKitException
-