Skip to content

The Drupal iOS Software Development Kit provides a full suite of iOS methods to natively connect iOS applications to Drupal 7 and 8.

License

Notifications You must be signed in to change notification settings

ReporterMagazine/drupal-ios-sdk

 
 

Repository files navigation

###Drupal iOS SDK - Connect your iOS/OS X app to Drupal

built by Kyle Browning

####Introduction

The Drupal iOS SDK is a standard set of libraries for communicating to Drupal from any iOS device. Its extremely simple, and is basically a wrapper for AFNetworking. It combines the most used commands to communicate with Drupal and handles session managment for you(but it doesnt store passwords or persist CSRF/oAUTH tokens, you must do that(at least yet :))

####Installation

Create a pod file with (this will keep you on the 3.0 releases which is Drupal 8 specific)

 pod 'drupal-ios-sdk', '~> 3.0'

Then run

pod install

Requirements

DIOS Version Drupal Version Min iOS Target Notes
3.x Drupal 8 iOS 7.0
2.x Drupal 6-7 iOS 5.0 Requires Services module

####Configuration

In Drupal 8 things are a bit different, but much easier.

####First steps

 DIOSSession *sharedSession = [DIOSSession sharedSession];
 [sharedSession setBaseURL:[NSURL URLWithString:@"http://d8"]];
 [sharedSession setBasicAuthCredsWithUsername:@"admin" andPassword:@"pass"];

Currently 3.x only supports basic auth but will support oAuth soon

####Quick Examples

 //create new user
 NSDictionary *user = @{@"name":@[@{@"value":@"username"}],@"mail":@[@{@"value":@"[email protected]"}],@"pass":@[@{@"value":@"passw0rd"}]};
 [DIOSUser createUserWithParams:user success:nil failure:nil];

 //update existing node
 NSDictionary *node = @{@"uid":@[@{@"target_id":@"1"} ],@"body":@[@{@"value":@"Updated BOdy ",@"format":@"full_html"}],@"title":@[@{@"value":@"Updated Title"}]};
 [DIOSNode patchNodeWithID:@"12" params:node type:@"page" success:nil failure:nil];

 //create new comment
 NSDictionary *parameters = @{@"subject":@[@{@"value":@"comment title"}],@"comment_body":@[@{@"value":@"a new body",@"format":@"basic_html"}]};
 [DIOSComment createCommentWithParams:parameters relationID:@"7" type:@"comment" success:nil failure:nil];
 
 //get a user
 [DIOSUser getUserWithID:@"1" success:nil failure:nil];
 
 //delete a node
 [DIOSNode deleteNodeWithID:@"13" success:nil failure:nil];

####Extras

Drupal iOS SDK Addons

####OAuth

Coming soon

####Troubleshooting

If you are getting Forbidden, you probably havnt setup your permissions.

####Questions

Checkout the Issue queue, or email me Email [email protected]

About

The Drupal iOS Software Development Kit provides a full suite of iOS methods to natively connect iOS applications to Drupal 7 and 8.

Resources

License

Stars

Watchers

Forks

Packages

No packages published