RKRequest Class Reference
| Inherits from | NSObject |
| Declared in | RKRequest.h RKRequest.m |
Tasks
Other Methods
-
URLThe URL this request is loading
property -
resourcePathThe resourcePath portion of this loader’s URL
property -
methodThe HTTP verb the request is sent via
property -
paramsA serializable collection of parameters sent as the HTTP Body of the request
property -
delegateThe delegate to inform when the request is completed
property -
additionalHTTPHeadersA Dictionary of additional HTTP Headers to send with the request
property -
userDataAn opaque pointer to associate user defined data with the request.
property -
URLRequestThe underlying NSMutableURLRequest sent for this request
property -
HTTPMethodThe HTTP method as a string used for this request
property -
queueThe request queue that this request belongs to
property -
backgroundPolicyThe policy to take on transition to the background (iOS 4.x and higher only)
property
Authentication
-
authenticationTypeThe type of authentication to use for this request.
property -
usernameThe username to use for an HTTP Authentication
property -
passwordThe password to use for an HTTP Authentication
property -
OAuth1ConsumerKeyThe OAuth 1.0 consumer key
property -
OAuth1ConsumerSecretThe OAuth 1.0 consumer secret
property -
OAuth1AccessTokenThe OAuth 1.0 access token
property -
OAuth1AccessTokenSecretThe OAuth 1.0 access token secret
property -
OAuth2AccessTokenThe OAuth 2.0 access token
property -
OAuth2RefreshTokenThe OAuth 2.0 refresh token. Used to retrieve a new access token before expiration
property
Cacheing
-
cacheKeyReturns the cache key for getting/setting the cache entry for this request in the cache.
property -
cachePolicyThe cache policy used when storing this request into the request cache
property -
cacheThe request cache to store and load responses for this request
property -
– isCacheableReturns YES if the request is cacheable
-
HTTPBodyThe HTTP body as a NSData used for this request
property -
HTTPBodyStringThe HTTP body as a string used for this request
property -
cacheTimeoutIntervalThe timeout interval within which the request should not be sent and the cached response should be used. Used if the cache policy includes RKRequestCachePolicyTimeout
property -
+ requestWithURL:delegate:Return a REST request that is ready for dispatching
-
– initWithURL:Initialize a synchronous request
-
– initWithURL:delegate:Initialize a REST request and prepare it for dispatching
-
– prepareURLRequest -
– reset -
– sendSend the request asynchronously. It will be added to the queue and dispatched as soon as possible.
-
– sendAsynchronouslyImmediately dispatch a request asynchronously, skipping the request queue
-
– sendSynchronouslySend the request synchronously and return a hydrated response object
-
– didFailLoadWithError:Callback performed to notify the request that the underlying NSURLConnection has failed with an error.
-
– didFinishLoad:Callback performed to notify the request that the underlying NSURLConnection has completed with a response.
-
– cancelCancels the underlying URL connection. This will call the requestDidCancel: delegate method if your delegate responds to it. This does not subsequently set the the request’s delegate to nil. However, it’s good practice to cancel the RKRequest and immediately set the delegate property to nil within the delegate’s dealloc method.
-
– isGETReturns YES when this is a GET request
-
– isPOSTReturns YES when this is a POST request
-
– isPUTReturns YES when this is a PUT request
-
– isDELETEReturns YES when this is a DELETE request
-
– isHEADReturns YES when this is a HEAD request
-
– isLoadingReturns YES when this request is in-progress
-
– isLoadedReturns YES when this request has been completed
-
– isUnsentReturnes YES when this request has not yet been sent
-
– wasSentToResourcePath:Returns YES when the request was sent to the specified resource path
Properties
HTTPBody
The HTTP body as a NSData used for this request
@property (nonatomic, retain) NSData *HTTPBodyDeclared In
RKRequest.hHTTPBodyString
The HTTP body as a string used for this request
@property (nonatomic, retain) NSString *HTTPBodyStringDeclared In
RKRequest.hHTTPMethod
The HTTP method as a string used for this request
@property (nonatomic, readonly) NSString *HTTPMethodDeclared In
RKRequest.hOAuth1AccessToken
The OAuth 1.0 access token
@property (nonatomic, retain) NSString *OAuth1AccessTokenDeclared In
RKRequest.hOAuth1AccessTokenSecret
The OAuth 1.0 access token secret
@property (nonatomic, retain) NSString *OAuth1AccessTokenSecretDeclared In
RKRequest.hOAuth1ConsumerKey
The OAuth 1.0 consumer key
@property (nonatomic, retain) NSString *OAuth1ConsumerKeyDeclared In
RKRequest.hOAuth1ConsumerSecret
The OAuth 1.0 consumer secret
@property (nonatomic, retain) NSString *OAuth1ConsumerSecretDeclared In
RKRequest.hOAuth2AccessToken
The OAuth 2.0 access token
@property (nonatomic, retain) NSString *OAuth2AccessTokenDeclared In
RKRequest.hOAuth2RefreshToken
The OAuth 2.0 refresh token. Used to retrieve a new access token before expiration
@property (nonatomic, retain) NSString *OAuth2RefreshTokenDeclared In
RKRequest.hURL
The URL this request is loading
@property (nonatomic, retain) NSURL *URLDeclared In
RKRequest.hURLRequest
The underlying NSMutableURLRequest sent for this request
@property (nonatomic, readonly) NSMutableURLRequest *URLRequestDeclared In
RKRequest.hadditionalHTTPHeaders
A Dictionary of additional HTTP Headers to send with the request
@property (nonatomic, retain) NSDictionary *additionalHTTPHeadersDeclared In
RKRequest.hauthenticationType
The type of authentication to use for this request.
@property (nonatomic, assign) RKRequestAuthenticationType authenticationTypeDiscussion
When configured to RKRequestAuthenticationTypeHTTPBasic, RestKit will add an Authorization header establishing login via HTTP Basic. This is an optimization that skips the challenge portion of the request.
Default: RKRequestAuthenticationTypeNone
Declared In
RKRequest.hbackgroundPolicy
The policy to take on transition to the background (iOS 4.x and higher only)
@property (nonatomic, assign) RKRequestBackgroundPolicy backgroundPolicyDiscussion
Default: RKRequestBackgroundPolicyCancel
Declared In
RKRequest.hcache
The request cache to store and load responses for this request
@property (nonatomic, retain) RKRequestCache *cacheDiscussion
Generally configured by the RKClient instance that minted this request
Declared In
RKRequest.hcacheKey
@property (nonatomic, readonly) NSString *cacheKeyDiscussion
The cacheKey is an MD5 value computed by hashing a combination of the destination URL, the HTTP verb, and the request body (if possible)
Declared In
RKRequest.hcacheTimeoutInterval
The timeout interval within which the request should not be sent and the cached response should be used. Used if the cache policy includes RKRequestCachePolicyTimeout
@property (nonatomic, assign) NSTimeInterval cacheTimeoutIntervalDeclared In
RKRequest.hdelegate
The delegate to inform when the request is completed
@property (nonatomic, assign) NSObject<RKRequestDelegate> *delegateDiscussion
If the object implements the RKRequestDelegate protocol, it will receive request lifecycle event messages.
Declared In
RKRequest.hmethod
The HTTP verb the request is sent via
@property (nonatomic, assign) RKRequestMethod methodDiscussion
@default RKRequestMethodGET
Declared In
RKRequest.hparams
A serializable collection of parameters sent as the HTTP Body of the request
@property (nonatomic, retain) NSObject<RKRequestSerializable> *paramsDeclared In
RKRequest.hpassword
The password to use for an HTTP Authentication
@property (nonatomic, retain) NSString *passwordDeclared In
RKRequest.hqueue
The request queue that this request belongs to
@property (nonatomic, assign) RKRequestQueue *queueDeclared In
RKRequest.hresourcePath
The resourcePath portion of this loader’s URL
@property (nonatomic, retain) NSString *resourcePathDeclared In
RKRequest.huserData
An opaque pointer to associate user defined data with the request.
@property (nonatomic, retain) id userDataDeclared In
RKRequest.husername
The username to use for an HTTP Authentication
@property (nonatomic, retain) NSString *usernameDeclared In
RKRequest.hInstance Methods
cancel
Cancels the underlying URL connection. This will call the requestDidCancel: delegate method if your delegate responds to it. This does not subsequently set the the request’s delegate to nil. However, it’s good practice to cancel the RKRequest and immediately set the delegate property to nil within the delegate’s dealloc method.
- (void)cancelSee Also
NSURLConnection:– cancel
Declared In
RKRequest.hdidFailLoadWithError:
Callback performed to notify the request that the underlying NSURLConnection has failed with an error.
- (void)didFailLoadWithError:(NSError *)errorDeclared In
RKRequest.hdidFinishLoad:
Callback performed to notify the request that the underlying NSURLConnection has completed with a response.
- (void)didFinishLoad:(RKResponse *)responseDeclared In
RKRequest.hinitWithURL:
Initialize a synchronous request
- (id)initWithURL:(NSURL *)URLDeclared In
RKRequest.hinitWithURL:delegate:
Initialize a REST request and prepare it for dispatching
- (id)initWithURL:(NSURL *)URL delegate:(id)delegateDeclared In
RKRequest.hisCacheable
Returns YES if the request is cacheable
- (BOOL)isCacheableDiscussion
All requets are considered cacheable unless:
1) The method is DELETE
2) The request body is a stream (i.e. using RKParams)
Declared In
RKRequest.hisUnsent
Returnes YES when this request has not yet been sent
- (BOOL)isUnsentDeclared In
RKRequest.hsend
Send the request asynchronously. It will be added to the queue and dispatched as soon as possible.
- (void)sendDeclared In
RKRequest.hsendAsynchronously
Immediately dispatch a request asynchronously, skipping the request queue
- (void)sendAsynchronouslyDeclared In
RKRequest.h