+ Start a Discussion
aaronwardleaaronwardle 

How to post a Chatter Message with SFRestAPI for iOS

Hi, 

 

I am just getting started with salesforce.com development for a native iOS application and have downloaded the https://github.com/forcedotcom/SalesforceMobileSDK-iOS which so far looks pretty neat. 

 

I'm now trying to perform a simple test of posting a chatter message to my timeline, but cannot work out the easiest and best way to perform this?

 

Any help and pointers would be much appreciated. 

 

Thanks Aaron

Kevin HawkinsKevin Hawkins

Hi Aaron,

 

The REST API functionality in the SDK is pretty generic, and meant to offer flexible access methods to any REST API.  I would recommend looking through the Chatter REST API documentation, to see which endpoints you would want to hit.  Once you know how you want to form your data requests, you can create requests via the [SFRestRequest requestWithMethod:path:queryParams:] method, and send the requests using [[SFRestAPI sharedInstance] send:delegate:].  Take a look at the unit tests in SalesforceSDKTests to see how we do some basic exercising of the REST API libraries.

 

Hope this helps,

Kevin

 

Justas SerstkovasJustas Serstkovas
Hi aaronwardle,

I was looking for exactly same information, but was not able to find a clear example. There are a very goud description on this in
 http://www.salesforce.com/us/developer/docs/chatterapi/salesforce_chatter_rest_api.pdf 
on page 64 "Post to group" 

and great example of whole request in 
https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/ios_rest_apis_using_methods.htm
bullet point 5

Helped me a lot, was able to push POST request through to Chatter API and see it in the feed.

Thanks,
J
chidambaram samiappanchidambaram samiappan
Hi Justas,
I just completed the connected app creation and OAuth login in my application using the salesforce sdk. I don't know where and Which API request to start the chatter api implementation for native (Swift) iOS app.

Do we have swift implementation like the below implementation done in Objective-C?

SFRestRequest *request = [[SFRestRequest alloc] init];
[request setDelegate:self];
[request setEndpoint:kSFDefaultRestEndpoint];
[request setMethod:SFRestMethodGET];
[request setPath:[NSString stringWithFormat:@"/v26.0/chatter/feeds/record/%@/feed-items", recordId]];
[[SFRestAPI sharedInstance] send:request delegate:self];