public RateLimit getRateLimit ( ) throws OAuthSystemException , OAuthProblemException { cleanError ( ) ; prepareToken ( ) ; OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient ( ) ; OAuthClient oAuthClient = new OAuthClient ( httpClient ) ; OAuthClientRequest bearerRequest = new OAuthBearerClientRequest ( settings . getURL ( Constants . GET_RATE_URL ) ) //.setAccessToken(accessToken) // 'Authorization' => 'Bearer xxxx' not accepted right now . buildHeaderMessage ( ) ; Map < String , String > headers = getAuthorizedHeader ( ) ; bearerRequest . setHeaders ( headers ) ; OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient . resource ( bearerRequest , OAuth . HttpMethod . GET , OneloginOAuthJSONResourceResponse . class ) ; RateLimit ratelimit = null ; if ( oAuthResponse . getResponseCode ( ) == 200 ) { JSONObject data = oAuthResponse . getData ( ) ; if ( data != null ) { ratelimit = new RateLimit ( data ) ; } } else { error = oAuthResponse . getError ( ) ; errorDescription = oAuthResponse . getErrorDescription ( ) ; } return ratelimit ; }
Gets current rate limit details about an access token .