Inherits from NSObject
Declared in RKRequest.h
RKRequest.m

Overview

Models the request portion of an HTTP request/response cycle.

Tasks

Other Methods

Authentication

Cacheing

Properties

HTTPBody

The HTTP body as a NSData used for this request

@property (nonatomic, retain) NSData *HTTPBody

Declared In

RKRequest.h

HTTPBodyString

The HTTP body as a string used for this request

@property (nonatomic, retain) NSString *HTTPBodyString

Declared In

RKRequest.h

HTTPMethod

The HTTP method as a string used for this request

@property (nonatomic, readonly) NSString *HTTPMethod

Declared In

RKRequest.h

OAuth1AccessToken

The OAuth 1.0 access token

@property (nonatomic, retain) NSString *OAuth1AccessToken

Declared In

RKRequest.h

OAuth1AccessTokenSecret

The OAuth 1.0 access token secret

@property (nonatomic, retain) NSString *OAuth1AccessTokenSecret

Declared In

RKRequest.h

OAuth1ConsumerKey

The OAuth 1.0 consumer key

@property (nonatomic, retain) NSString *OAuth1ConsumerKey

Declared In

RKRequest.h

OAuth1ConsumerSecret

The OAuth 1.0 consumer secret

@property (nonatomic, retain) NSString *OAuth1ConsumerSecret

Declared In

RKRequest.h

OAuth2AccessToken

The OAuth 2.0 access token

@property (nonatomic, retain) NSString *OAuth2AccessToken

Declared In

RKRequest.h

OAuth2RefreshToken

The OAuth 2.0 refresh token. Used to retrieve a new access token before expiration

@property (nonatomic, retain) NSString *OAuth2RefreshToken

Declared In

RKRequest.h

URL

The URL this request is loading

@property (nonatomic, retain) NSURL *URL

Declared In

RKRequest.h

URLRequest

The underlying NSMutableURLRequest sent for this request

@property (nonatomic, readonly) NSMutableURLRequest *URLRequest

Declared In

RKRequest.h

additionalHTTPHeaders

A Dictionary of additional HTTP Headers to send with the request

@property (nonatomic, retain) NSDictionary *additionalHTTPHeaders

Declared In

RKRequest.h

authenticationType

The type of authentication to use for this request.

@property (nonatomic, assign) RKRequestAuthenticationType authenticationType

Discussion

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.h

backgroundPolicy

The policy to take on transition to the background (iOS 4.x and higher only)

@property (nonatomic, assign) RKRequestBackgroundPolicy backgroundPolicy

Discussion

Default: RKRequestBackgroundPolicyCancel

Declared In

RKRequest.h

cache

The request cache to store and load responses for this request

@property (nonatomic, retain) RKRequestCache *cache

Discussion

Generally configured by the RKClient instance that minted this request

Declared In

RKRequest.h

cacheKey

Returns the cache key for getting/setting the cache entry for this request in the cache.

@property (nonatomic, readonly) NSString *cacheKey

Discussion

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.h

cachePolicy

The cache policy used when storing this request into the request cache

@property (nonatomic, assign) RKRequestCachePolicy cachePolicy

Declared In

RKRequest.h

cacheTimeoutInterval

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 cacheTimeoutInterval

Declared In

RKRequest.h

delegate

The delegate to inform when the request is completed

@property (nonatomic, assign) NSObject<RKRequestDelegate> *delegate

Discussion

If the object implements the RKRequestDelegate protocol, it will receive request lifecycle event messages.

Declared In

RKRequest.h

method

The HTTP verb the request is sent via

@property (nonatomic, assign) RKRequestMethod method

Discussion

@default RKRequestMethodGET

Declared In

RKRequest.h

params

A serializable collection of parameters sent as the HTTP Body of the request

@property (nonatomic, retain) NSObject<RKRequestSerializable> *params

Declared In

RKRequest.h

password

The password to use for an HTTP Authentication

@property (nonatomic, retain) NSString *password

Declared In

RKRequest.h

queue

The request queue that this request belongs to

@property (nonatomic, assign) RKRequestQueue *queue

Declared In

RKRequest.h

resourcePath

The resourcePath portion of this loader’s URL

@property (nonatomic, retain) NSString *resourcePath

Declared In

RKRequest.h

userData

An opaque pointer to associate user defined data with the request.

@property (nonatomic, retain) id userData

Declared In

RKRequest.h

username

The username to use for an HTTP Authentication

@property (nonatomic, retain) NSString *username

Declared In

RKRequest.h

Class Methods

requestWithURL:delegate:

Return a REST request that is ready for dispatching

+ (RKRequest *)requestWithURL:(NSURL *)URL delegate:(id)delegate

Declared In

RKRequest.h

Instance 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)cancel

See Also

Declared In

RKRequest.h

didFailLoadWithError:

Callback performed to notify the request that the underlying NSURLConnection has failed with an error.

- (void)didFailLoadWithError:(NSError *)error

Declared In

RKRequest.h

didFinishLoad:

Callback performed to notify the request that the underlying NSURLConnection has completed with a response.

- (void)didFinishLoad:(RKResponse *)response

Declared In

RKRequest.h

initWithURL:

Initialize a synchronous request

- (id)initWithURL:(NSURL *)URL

Declared In

RKRequest.h

initWithURL:delegate:

Initialize a REST request and prepare it for dispatching

- (id)initWithURL:(NSURL *)URL delegate:(id)delegate

Declared In

RKRequest.h

isCacheable

Returns YES if the request is cacheable

- (BOOL)isCacheable

Discussion

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.h

isDELETE

Returns YES when this is a DELETE request

- (BOOL)isDELETE

Declared In

RKRequest.h

isGET

Returns YES when this is a GET request

- (BOOL)isGET

Declared In

RKRequest.h

isHEAD

Returns YES when this is a HEAD request

- (BOOL)isHEAD

Declared In

RKRequest.h

isLoaded

Returns YES when this request has been completed

- (BOOL)isLoaded

Declared In

RKRequest.h

isLoading

Returns YES when this request is in-progress

- (BOOL)isLoading

Declared In

RKRequest.h

isPOST

Returns YES when this is a POST request

- (BOOL)isPOST

Declared In

RKRequest.h

isPUT

Returns YES when this is a PUT request

- (BOOL)isPUT

Declared In

RKRequest.h

isUnsent

Returnes YES when this request has not yet been sent

- (BOOL)isUnsent

Declared In

RKRequest.h

prepareURLRequest

- (BOOL)prepareURLRequest

Declared In

RKRequest.h

reset

- (void)reset

Declared In

RKRequest.h

send

Send the request asynchronously. It will be added to the queue and dispatched as soon as possible.

- (void)send

Declared In

RKRequest.h

sendAsynchronously

Immediately dispatch a request asynchronously, skipping the request queue

- (void)sendAsynchronously

Declared In

RKRequest.h

sendSynchronously

Send the request synchronously and return a hydrated response object

- (RKResponse *)sendSynchronously

Declared In

RKRequest.h

wasSentToResourcePath:

Returns YES when the request was sent to the specified resource path

- (BOOL)wasSentToResourcePath:(NSString *)resourcePath

Declared In

RKRequest.h