function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Akshaya PanigrahiAkshaya Panigrahi 

How to fetch data in forcehybrid app using REST api

Hi All,

I have created a hybrid app using forcehybrid. I am able to login to coonected salesforce app.
Now I need to fetch data from salesforce using REST api.
I am not getting any reference in docs for hybrid app.
Can someone help me out here. Any reference or example will be very helpful. Thank you!
Best Answer chosen by Akshaya Panigrahi
Todd Halfpenny MCTodd Halfpenny MC
Akshaya,

That pages lists the sample apps that use the REST API , e.g. the contactexplorer - that can be found here https://github.com/forcedotcom/SalesforceMobileSDK-Shared/tree/master/samples/contactexplorer.

Check the inline.js that has examples of setting up the session and making calls to pull down contacts.
 

All Answers

Todd Halfpenny MCTodd Halfpenny MC
Hi Akshaya,

There are examples/samples available for this. Details can be found here (https://developer.salesforce.com/docs/atlas.en-us.mobile_sdk.meta/mobile_sdk/hybrid_samples.htm
Akshaya PanigrahiAkshaya Panigrahi
Hi Todd,

Thank you for the link.
But I do not see where REST api is used. I have made custom REST webservices (url like /services/apexrest/Search) which I want to invoke in mobile app.
Please help me how can I do this.
Todd Halfpenny MCTodd Halfpenny MC
Akshaya,

That pages lists the sample apps that use the REST API , e.g. the contactexplorer - that can be found here https://github.com/forcedotcom/SalesforceMobileSDK-Shared/tree/master/samples/contactexplorer.

Check the inline.js that has examples of setting up the session and making calls to pull down contacts.
 
This was selected as the best answer
Todd Halfpenny MCTodd Halfpenny MC
It's also worth mentioning that the trailhead at the following link goes through this too. I hope I've not misunderstood what you're trying to do.
https://trailhead.salesforce.com/content/learn/modules/mobile_sdk_hybrid