Class AuthorizeVisitRequest


public class AuthorizeVisitRequest extends PostRequest
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 Details

  • Method Details

    • getContentType

      protected HttpContentType getContentType()
      Specified by:
      getContentType in class PostRequest
    • getPath

      protected String getPath()
      Specified by:
      getPath in class BaseApiRequest
    • ip

      public AuthorizeVisitRequest ip(String strIpAddress)
      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

      public AuthorizeVisitRequest url(String strUrl)
      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

      public AuthorizeVisitRequest userAgent(String strUserAgent)
      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

      public AuthorizeVisitRequest referrer(String strReferrer)
      Sets the visit referrer. Referrer can typically be found in the "Referer" (famously misspelled) HTTP header.
      Parameters:
      strReferrer - the referrer
      Returns:
      this
    • sessionId

      public AuthorizeVisitRequest sessionId(String strSessionId)
      Sets the visitor session ID. Finding session ID may depend on server implementation. For Java's HttpSession, you can get it from the getId method.
      Parameters:
      strSessionId - the session ID
      Returns:
      this
    • userId

      public AuthorizeVisitRequest userId(Long lUserId)
      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

      public AuthorizeVisitRequest record(boolean bShouldRecord)
      Sets whether to record the visit in the database. Unrecorded visits will not affect visit counts. Visits are recorded by default.
      Parameters:
      bShouldRecord - true to save visit (default), false to not save visit
      Returns:
      this
    • send

      public Visit send() throws NetToolKitException
      Sends the request.
      Returns:
      a visit object containing authorization information
      Throws:
      NetToolKitException