• ngOne
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

Hi I have tried a few option here but none seem to work, I dont know if it's because the sdk will only work with JSON data and not sure if i should go for SOAP Calls. I can list my libraries, and documents contained but cant download a document.

 

//# Option 1: Using the api factory method for the request. Of course it expects JSON return.
SFRestRequest *request = [[SFRestAPI sharedInstance] requestForRetrieveWithObjectType:@"ContentVersion" objectId:documentId fieldList: @"VersionData"];
    
     //# Option 2: Method executes but again it's expecting json return
    SFRestRequest *request = [[SFRestRequest alloc] init];
    [request setPath: @"/v23.0/sobjects/ContentVersion/[object id]/VersionData"];
    [request setMethod: SFRestMethodGET];
    [[SFRestAPI sharedInstance] send:request delegate:self];
    
    //#Option 3: get html error saying that the page doesnt exist,  could be related to the new url that needs to be set after login process, dont know how tho get it from the framework.

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

 

  • December 28, 2011
  • Like
  • 0

Hi I have tried a few option here but none seem to work, I dont know if it's because the sdk will only work with JSON data and not sure if i should go for SOAP Calls. I can list my libraries, and documents contained but cant download a document.

 

//# Option 1: Using the api factory method for the request. Of course it expects JSON return.
SFRestRequest *request = [[SFRestAPI sharedInstance] requestForRetrieveWithObjectType:@"ContentVersion" objectId:documentId fieldList: @"VersionData"];
    
     //# Option 2: Method executes but again it's expecting json return
    SFRestRequest *request = [[SFRestRequest alloc] init];
    [request setPath: @"/v23.0/sobjects/ContentVersion/[object id]/VersionData"];
    [request setMethod: SFRestMethodGET];
    [[SFRestAPI sharedInstance] send:request delegate:self];
    
    //#Option 3: get html error saying that the page doesnt exist,  could be related to the new url that needs to be set after login process, dont know how tho get it from the framework.

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

 

  • December 28, 2011
  • Like
  • 0