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
brumbrum 

How to download text file and images from Salesforce using ios and rest api

I am new in Salesforce and ios development. I need to download a text file and images from Salesforce (Files or Libraries) and save it on disk using ios and rest api. I am trying this code below, but it doesn't work or not complete. Please, someone help me to know :

1) What is the correct url?

2) What is object id length : 15 or 18?

3) How to get OAuth token and Authorization? I have my consumer key, login domain,...

4) The complete code like methods to handle the response, error, ...

 

    NSURL *myURL = [NSURL URLWithString:@"https://test.salesforce.com/v23.0/sobjects/ContentVersion/<objectID>/VersionData"];
    NSMutableURLRequest* requestDoc = [[NSMutableURLRequest alloc] initWithURL:myURL];
    [requestDoc addValue:@"OAuth token" forHTTPHeaderField:@"Authorization"];
    [NSURLConnection connectionWithRequest:requestDoc delegate:self];

 

Thanks,

brum

J2theCJ2theC

You need to get the token and other session information from the SFOAuthCredentials object from the SFOAuthCoordinator object that is a part of the SFRestAPI singleton object.

SoleesSolees

I agree to J2theC

 

you need the token and user org to make it dynamic.

listerrrlisterrr
Nithya venkatNithya venkat
Thank you so much @"listerrr".Searching the solution for a long time and got to see it !!!!