Supported REST Services

Mobile SDK REST APIs support the standard object operations offered by Salesforce Platform REST and SOAP APIs. For most operation types, a factory method or factory object creates a REST request object specifically for that operation. You send this request object to Salesforce using the Mobile SDK REST API and receive the response asynchronously.

After you’ve sent a request to Salesforce, the response arrives in your app asynchronously. To handle these responses, you can specify a callback delegate when you send the request, or define a closure (Swift only).

Notification

Get a notification.

Delegate Method
Swift
1RestClient.shared.request(forNotification:apiVersion:)
Objective-C
1- (SFRestRequest *)requestForNotification:(NSString *)notificationId apiVersion:(NSString *)apiVersion;

Block Method

Not available.

Notifications Status

Get the status of a range of notifications, including unread and unseen count.

Delegate Method
Swift
1RestClient.shared.request(forNotificationsStatus:)
Objective-C
1- (SFRestRequest *)requestForNotificationsStatus:(NSString *)apiVersion;

Block Method

Not available.

Notifications

Get the given number (maximum 20) of archived Notification Builder notifications based on the given “before” or “after” date. In Mobile SDK, use the Swift FetchNotificationsRequestBuilder object or the Objective-C SFSDKFetchNotificationsRequestBuilder to create GET requests for notifications.

Delegate Method
Swift
1let builder = FetchNotificationsRequestBuilder.init()
2builder.setSize(10)
3builder.setBefore(Date.init())
4let request = builder.buildFetchNotificationsRequest(SFRestDefaultAPIVersion)
Objective-C
1SFSDKFetchNotificationsRequestBuilder *builder = 
2    [[SFSDKFetchNotificationsRequestBuilder alloc] init];
3[builder setBefore: [NSDate date]];
4[builder setSize:10];
5SFRestRequest *fetchRequest = 
6    [builder buildFetchNotificationsRequest:kSFRestDefaultAPIVersion];

Block Method

Not available.

Notifications Update

Update the “read” and “seen” statuses of a given set of Notification Builder notifications. In Mobile SDK, use the Swift UpdateNotificationsRequestBuilder object or the Objective-C SFSDKUpdateNotificationsRequestBuilder object to create update requests.

To update a single notification, set the notificationId property. To update a range of notifications, set either the notificationIds or the before property. These properties—notificationId, notificationIds, and before—are mutually exclusive.

Delegate Method
Swift
1let builder = UpdateNotificationsRequestBuilder.init()
2builder.setBefore(Date.init())
3builder.setRead(true)
4builder.setSeen(true)
5let request = builder.buildUpdateNotificationsRequest(SFRestDefaultAPIVersion)
Objective-C
1SFSDKUpdateNotificationsRequestBuilder *builder = 
2    [[SFSDKUpdateNotificationsRequestBuilder alloc] init];
3[builder setRead:true];
4[builder setSeen:true];
5[builder setBefore: [NSDate date]];
6SFRestRequest *updateRequest = [builder buildUpdateNotificationsRequest:kSFRestDefaultAPIVersion];

Block Method

Not available.

Example

For sample calls, see /libs/SalesforceSDKCore/SalesforceSDKCoreTests/SalesforceRestAPITests.m at github.com/forcedotcom/SalesforceMobileSDK-iOS.