Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #541 from amallavarapu/patch-1

Added documentation for handling GET and POST params.
  • Loading branch information...
commit bf1b8c5366add8b680b17b3d231ebb1db9faa78f 2 parents c19a500 + e0e3019
@blakewatters blakewatters authored
Showing with 24 additions and 0 deletions.
  1. +24 −0 Docs/Object Mapping.md
View
24 Docs/Object Mapping.md
@@ -136,6 +136,30 @@ transformed into one or more instances of the `Article` class. Once mappable dat
key path should be assigned to the target object at the destination key path. This is the fundamental trick of object mapping and all other features
are built upon this foundation.
+### Parameters
+
+GET query parameters should be added with the new NSString method appendQueryParameters. For example,
+
+```objc
+- (void)loadArticlesContainingText:(NSString *)searchText {
+ NSDictionary *queryParams = [NSDictionary dictionaryWithObject:searchText forKey:@"q"];
+ NSString *resourcePath = [@"/articles" appendQueryParameters:queryParams];
+ [[RKObjectManager sharedManager] loadObjectsAtResourcePath:resourcePath delegate:self];
+}
+```
+
+POST parameters can be provided by setting the RKObjectLoader's params property:
+
+```objc
+- (void)saveArticleWithAdditionalParams:(NSDictionary *)extraPOSTParams {
+ RKObjectLoader* loader = [objectManager sendObject:human delegate:responseLoader block:^(RKObjectLoader* loader) {
+ loader.method = RKRequestMethodPOST;
+ loader.resourcePath = @"/articles/create";
+ loader.params = extraPOSTParams;
+ }];
+}
+```
+
## Object Mapping Fundamentals
Now that we have established a foundation for the basics of object mapping, we can explore the remaining portions of the system. We'll examine
Please sign in to comment.
Something went wrong with that request. Please try again.