| File |
Line |
| com/netflix/api/client/NetflixAPIClient.java |
221 |
| com/netflix/api/client/NetflixAPIClient.java |
265 |
else throw new NetflixAPIException("No valid HTTP method specified: must be GET, POST or DELETE for customer authorized calls.");
httpClient.executeMethod(method);
response.setResponseBody(method.getResponseBodyAsString());
response.setStatusCode(method.getStatusCode());
response.setStatusLine(method.getStatusLine().toString());
response.setResponseHeaders(this.resolveResponseHeaders(method));
method.releaseConnection();
if (logger.isDebugEnabled())
{
response.setExecutionSummary("Calling [" + uri + "] resulted in status code [" + response.getStatusLine() + "] and response\n" + response.getResponseBody());
logger.debug(response.getExecutionSummary());
}
return response;
}
/**
* Calls the Netflix API using the "Access Token and Secret" level of security.
* Use this for accessing/managing a customer's information.
*
* @param uri - the uri to call
* @param customer - the netflix customer on whose behalf the call is being made.
* @param callParameters - a map of key-value pairs to be placed in the query string
* (for GET methods) or in the POST body (for POSTs).
* @param methodType - either "GET", "DELETE" or "POST".
* @return - a string of the server's response
* @throws Exception - if a server communication error occurs.
*/
public NetflixAPIResponse makeCustomerAuthorizedApiCall(String uri, NetflixAPICustomer customer, Map<String, String> callParameters,
|
| File |
Line |
| com/netflix/api/client/dal/HttpMethodBuilder.java |
432 |
| com/netflix/api/client/dal/HttpMethodBuilder.java |
467 |
public PostMethod buildConsumerSignedPostMethodWithAccessSecretAndQueryString(String uri, Map<String, String> parameters, OAuthAccessToken accessToken) throws Exception
{
PostMethod method = new PostMethod(uri);
method.setDoAuthentication(true);
parameters.put("oauth_timestamp", OAuthUtils.getNewOAuthTimeStamp());
parameters.put("oauth_nonce", OAuthUtils.getNewNonceValue());
parameters.put("oauth_token", accessToken.getTokenText());
String signatureBaseString = OAuthUtils.getSignatureBaseString("POST", uri, parameters);
String signatureParameter = OAuthUtils.getHMACSHASignature(signatureBaseString, this.netflixAPIClient.getConsumerSecret(), accessToken.getTokenSecret());
parameters.put("oauth_signature", signatureParameter);
String queryString = this.createNormalizedQueryString((HashMap<String, String>) parameters);
|
| File |
Line |
| com/netflix/api/client/NetflixAPIClient.java |
264 |
| com/netflix/api/client/NetflixAPIClient.java |
309 |
method = methodBuilder.buildCustomerAuthorizedDeleteMethod(uri, callParameters, customer, requestHeaders);
else throw new NetflixAPIException("No valid HTTP method specified: must be GET, POST or DELETE for customer authorized calls.");
httpClient.executeMethod(method);
response.setResponseBody(method.getResponseBodyAsString());
response.setStatusCode(method.getStatusCode());
response.setStatusLine(method.getStatusLine().toString());
response.setResponseHeaders(this.resolveResponseHeaders(method));
method.releaseConnection();
if (logger.isDebugEnabled())
{
response.setExecutionSummary("Calling [" + uri + "] resulted in status code [" + response.getStatusLine() + "] and response\n" + response.getResponseBody());
logger.debug(response.getExecutionSummary());
}
return response;
}
/**
* @param method
* @return
*/
public NetflixAPIResponse executeCustomMethod(HttpMethod method) throws Exception
|
| File |
Line |
| com/netflix/api/client/NetflixAPIClient.java |
182 |
| com/netflix/api/client/NetflixAPIClient.java |
221 |
else throw new NetflixAPIException("No valid HTTP method specified: must be GET or POST for consumer-signed calls.");
httpClient.executeMethod(method);
response.setResponseBody(method.getResponseBodyAsString());
response.setStatusCode(method.getStatusCode());
response.setStatusLine(method.getStatusLine().toString());
response.setResponseHeaders(this.resolveResponseHeaders(method));
method.releaseConnection();
if (logger.isDebugEnabled())
{
response.setExecutionSummary("Calling [" + uri + "] resulted in status code [" + response.getStatusLine() + "] and response\n" + response.getResponseBody());
logger.debug(response.getExecutionSummary());
}
return response;
}
/**
* Calls the Netflix API using the "Access Token and Secret" level of security.
* Use this for accessing/managing a customer's information.
*
* @param uri - the uri to call
* @param customer - the netflix customer on whose behalf the call is being made.
* @param callParameters - a map of key-value pairs to be placed in the query string
* (for GET methods) or in the POST body (for POSTs).
* @param methodType - either "GET", "DELETE" or "POST".
* @return - a string of the server's response
* @throws Exception - if a server communication error occurs.
*/
public NetflixAPIResponse makeCustomerAuthorizedApiCall(String uri, NetflixAPICustomer customer, Map<String, String> callParameters, String methodType) throws Exception
|