SFRestAPI Class Reference
Inherits from | NSObject |
---|---|
Declared in | SFRestAPI.h |
Overview
Main class used to issue REST requests to the standard Force.com REST API. See the Force.com REST API Developer’s Guide for more information regarding the Force.com REST API.
We declare here a set of interfaces that are meant to be used by code running internally to SFRestAPI or close “friend” classes such as unit test helpers. You SHOULD NOT access these interfaces from application code. If you find yourself accessing properties or calling methods declared in this file from app code, you’re probably doing something wrong.
This category assists with creating SOQL and SOSL queries.
Example SOQL usage:
NSString *soqlQuery = [SFRestAPI SOQLQueryWithFields:[NSArray arrayWithObjects:@“Id”, @“Name”, @“Company”, @“Status”, nil] sObject:@“Lead” whereClause:nil limit:10];
Example SOSL usage:
NSString *soslQuery = [SFRestAPI SOSLSearchWithSearchTerm:@“all of these will be escaped:~{]” objectScope:[NSDictionary dictionaryWithObject:@“WHERE isactive=true ORDER BY lastname asc limit 5” forKey:@“User”]];
Other Methods
apiVersion
The REST API version used for all the calls.
The default value is kSFRestDefaultAPIVersion
(currently “v60.0”)
@property (nonatomic, strong) NSString *apiVersion
Declared In
SFRestAPI.h
)
The user associated with this instance of SFRestAPI.
@property (nonatomic, strong, readonly) SFUserAccount *NS_SWIFT_NAME ( userAccount )
Declared In
SFRestAPI.h
+ sharedInstanceWithUser:
Returns the singleton instance of SFRestAPI
associated with the specified user.
+ (nullable SFRestAPI *)sharedInstanceWithUser:(nonnull SFUserAccount *)userAccount
Declared In
SFRestAPI.h
+ setIsTestRun:
Specifies whether the current execution is a test run.
+ (void)setIsTestRun:(BOOL)isTestRun
Parameters
isTestRun |
YES if this is a test run. |
---|
Declared In
SFRestAPI.h
+ getIsTestRun
Indicates whether the current execution is a test run.
+ (BOOL)getIsTestRun
Return Value
True if this execution is a test run.
Declared In
SFRestAPI.h
– cancelAllRequests
Cancel all requests that are waiting to be executed.
- (void)cancelAllRequests
Declared In
SFRestAPI.h
– send:requestDelegate:
Sends a REST request to the Salesforce server and invokes the appropriate delegate method.
- (void)send:(SFRestRequest *)request requestDelegate:(nullable id<SFRestRequestDelegate>)requestDelegate
Parameters
request |
|
---|---|
requestDelegate |
Delegate object that handles the server response. |
Declared In
SFRestAPI.h
SFRestRequest factory methods
– requestForUserInfo
Returns an SFRestRequest
object that returns information associated with the current user.
- (SFRestRequest *)requestForUserInfo
Declared In
SFRestAPI.h
– requestForSingleAccess:
Returns an SFRestRequest
object that returns URL to bridge into UI sessions (a front door URL).
- (SFRestRequest *)requestForSingleAccess:(NSString *)redirectUri
Parameters
redirectUri |
A relative path that points to where the user is redirected when their new session begins. |
---|
Declared In
SFRestAPI.h
– requestForVersions
Returns an SFRestRequest
object that lists summary information about each
Salesforce.com version currently available. Summaries include the version,
label, and a link to each version’s root.
- (SFRestRequest *)requestForVersions
See Also
Declared In
SFRestAPI.h
– requestForLimits:
Returns an SFRestRequest
object that returns information about limits in your org
- (SFRestRequest *)requestForLimits:(nullable NSString *)apiVersion
See Also
Declared In
SFRestAPI.h
– cheapRequest:
Returns an SFRestRequest
object for a cheap request to re-hydrate the access token
- (SFRestRequest *)cheapRequest:(nullable NSString *)apiVersion
Declared In
SFRestAPI.h
– requestForResources:
Returns an SFRestRequest
object that lists available resources for the
client’s API version, including resource name and URI.
- (SFRestRequest *)requestForResources:(nullable NSString *)apiVersion
Parameters
apiVersion |
API version. |
---|
See Also
Declared In
SFRestAPI.h
– requestForDescribeGlobal:
Returns an SFRestRequest
object that lists available objects in your org and their
metadata.
- (SFRestRequest *)requestForDescribeGlobal:(nullable NSString *)apiVersion
Parameters
apiVersion |
API version. |
---|
Declared In
SFRestAPI.h
– requestForMetadataWithObjectType:apiVersion:
Returns an SFRestRequest
object that describes the individual metadata for the
specified object.
- (SFRestRequest *)requestForMetadataWithObjectType:(NSString *)objectType apiVersion:(nullable NSString *)apiVersion
Parameters
objectType |
Type of a Salesforce object. Example: “Account”. |
---|---|
apiVersion |
API version. |
Declared In
SFRestAPI.h
– requestForDescribeWithObjectType:apiVersion:
Returns an SFRestRequest
object that completely describes the metadata
at all levels for the specified object.
- (SFRestRequest *)requestForDescribeWithObjectType:(NSString *)objectType apiVersion:(nullable NSString *)apiVersion
Parameters
objectType |
Type of a Salesforce object. Example: “Account”. |
---|---|
apiVersion |
API version. |
Declared In
SFRestAPI.h
– requestForLayoutWithObjectAPIName:formFactor:layoutType:mode:recordTypeId:apiVersion:
Returns an SFRestRequest
object that provides layout data for the specified parameters.
- (SFRestRequest *)requestForLayoutWithObjectAPIName:(nonnull NSString *)objectAPIName formFactor:(nullable NSString *)formFactor layoutType:(nullable NSString *)layoutType mode:(nullable NSString *)mode recordTypeId:(nullable NSString *)recordTypeId apiVersion:(nullable NSString *)apiVersion
Parameters
objectAPIName |
Object API name. |
---|---|
formFactor |
Form factor. Could be “Large”, “Medium” or “Small”. Default value is “Large”. |
layoutType |
Layout type. Could be “Compact” or “Full”. Default value is “Full”. |
mode |
Mode. Could be “Create”, “Edit” or “View”. Default value is “View”. |
recordTypeId |
Record type ID. Default will be used if not supplied. |
apiVersion |
API version. |
Declared In
SFRestAPI.h
– requestForRetrieveWithObjectType:objectId:fieldList:apiVersion:
Returns an SFRestRequest
object that retrieves field values for the specified record of the given type.
- (SFRestRequest *)requestForRetrieveWithObjectType:(NSString *)objectType objectId:(NSString *)objectId fieldList:(nullable NSString *)fieldList apiVersion:(nullable NSString *)apiVersion
Parameters
objectType |
Type of a Salesforce object. Example: “Account”. |
---|---|
objectId |
Requested record’s object ID. |
fieldList |
Comma-separated list of fields for which to return values. Example: “Name,Industry,TickerSymbol”. Pass nil to retrieve all the fields. |
apiVersion |
API version. |
Declared In
SFRestAPI.h
– requestForCreateWithObjectType:fields:apiVersion:
Returns an SFRestRequest
object that creates a new record of the given type.
- (SFRestRequest *)requestForCreateWithObjectType:(NSString *)objectType fields:(nullable NSDictionary<NSString*,id> *)fields apiVersion:(nullable NSString *)apiVersion
Parameters
objectType |
Type of a Salesforce object. Example: “Account”. |
---|---|
fields |
|
apiVersion |
API version. |
Declared In
SFRestAPI.h
– requestForUpsertWithObjectType:externalIdField:externalId:fields:apiVersion:
Returns an SFRestRequest
object that creates or updates record of the given type, based on the
given external ID.
- (SFRestRequest *)requestForUpsertWithObjectType:(NSString *)objectType externalIdField:(NSString *)externalIdField externalId:(nullable NSString *)externalId fields:(NSDictionary<NSString*,id> *)fields apiVersion:(nullable NSString *)apiVersion
Parameters
objectType |
Type of a Salesforce object. Example: “Account”. |
---|---|
externalIdField |
External ID field name. Example: “accountMaster__c”. |
externalId |
Requested record’s external ID value. |
fields |
|
apiVersion |
API version. |
Declared In
SFRestAPI.h
– requestForUpdateWithObjectType:objectId:fields:apiVersion:
Returns an SFRestRequest
object that updates field values on a record of the given type.
- (SFRestRequest *)requestForUpdateWithObjectType:(NSString *)objectType objectId:(NSString *)objectId fields:(nullable NSDictionary<NSString*,id> *)fields apiVersion:(nullable NSString *)apiVersion
Parameters
objectType |
Type of a Salesforce object. Example: “Account”. |
---|---|
objectId |
Requested record’s object ID. |
fields |
|
apiVersion |
API version. |
Declared In
SFRestAPI.h
– requestForUpdateWithObjectType:objectId:fields:ifUnmodifiedSinceDate:apiVersion:
Same as requestForUpdateWithObjectType:objectId:fields but only executing update
if the server record was not modified since ifModifiedSinceDate
.
- (SFRestRequest *)requestForUpdateWithObjectType:(NSString *)objectType objectId:(NSString *)objectId fields:(nullable NSDictionary<NSString*,id> *)fields ifUnmodifiedSinceDate:(nullable NSDate *)ifUnmodifiedSinceDate apiVersion:(nullable NSString *)apiVersion
Parameters
objectType |
Type of a Salesforce object. Example: “Account”. |
---|---|
objectId |
Requested record’s object ID. |
fields |
|
ifUnmodifiedSinceDate |
Update occurs only if the current last modified date of the specified record is
older than |
apiVersion |
API version. |
Declared In
SFRestAPI.h
– requestForDeleteWithObjectType:objectId:apiVersion:
Returns an SFRestRequest
object that deletes a record of the given type.
- (SFRestRequest *)requestForDeleteWithObjectType:(NSString *)objectType objectId:(NSString *)objectId apiVersion:(nullable NSString *)apiVersion
Parameters
objectType |
Type of a Salesforce object. Example: “Account”. |
---|---|
objectId |
Requested record’s object ID. |
apiVersion |
API version. |
Declared In
SFRestAPI.h
– requestForQuery:apiVersion:
Returns an SFRestRequest
object that executes the specified SOQL query.
- (SFRestRequest *)requestForQuery:(NSString *)soql apiVersion:(nullable NSString *)apiVersion
Parameters
soql |
String containing the query to execute. Example: “SELECT Id, Name from Account ORDER BY Name LIMIT 20”. |
---|---|
apiVersion |
API version. |
See Also
Declared In
SFRestAPI.h
– requestForQuery:apiVersion:batchSize:
Returns an SFRestRequest
object that executes the specified SOQL query.
- (SFRestRequest *)requestForQuery:(NSString *)soql apiVersion:(nullable NSString *)apiVersion batchSize:(NSInteger)batchSize
Parameters
soql |
String containing the query to execute. Example: “SELECT Id, Name from Account ORDER BY Name LIMIT 20”. |
---|---|
apiVersion |
API version. |
batchSize |
Batch size: number between 200 and 2000 (default). |
See Also
Declared In
SFRestAPI.h
– requestForQueryAll:apiVersion:
Returns an SFRestRequest
object that executes the specified SOQL query.
The result includes deleted objects.
- (SFRestRequest *)requestForQueryAll:(NSString *)soql apiVersion:(nullable NSString *)apiVersion
Parameters
soql |
String containing the query to execute. Example: “SELECT Id, Name from Account ORDER BY Name LIMIT 20”. |
---|---|
apiVersion |
API version. |
See Also
Declared In
SFRestAPI.h
– requestForSearch:apiVersion:
Returns an SFRestRequest
object that executes the specified SOSL search.
- (SFRestRequest *)requestForSearch:(NSString *)sosl apiVersion:(nullable NSString *)apiVersion
Parameters
sosl |
String containing the search to execute. Example: “FIND {needle}”. |
---|---|
apiVersion |
API version. |
See Also
Declared In
SFRestAPI.h
– requestForSearchScopeAndOrder:
Returns an SFRestRequest
object that returns an ordered list of objects in the default global search scope of a logged-in user.
- (SFRestRequest *)requestForSearchScopeAndOrder:(nullable NSString *)apiVersion
Parameters
apiVersion |
API version. |
---|
Declared In
SFRestAPI.h
– requestForSearchResultLayout:apiVersion:
Returns an SFRestRequest
object that contains search result layout information for the objects in the query string.
- (SFRestRequest *)requestForSearchResultLayout:(NSString *)objectList apiVersion:(nullable NSString *)apiVersion
Parameters
objectList |
Comma-separated list of objects for which to return values. Example: “Account,Contact”. |
---|---|
apiVersion |
API version. |
Declared In
SFRestAPI.h
– batchRequest:haltOnError:apiVersion:
Returns an SFRestRequest
object that executes a batch of requests.
- (SFRestRequest *)batchRequest:(NSArray<SFRestRequest*> *)requests haltOnError:(BOOL)haltOnError apiVersion:(nullable NSString *)apiVersion
Parameters
requests |
Array of subrequests to execute. |
---|---|
haltOnError |
Controls whether Salesforce stops processing subrequests if a subrequest fails. |
apiVersion |
API version. |
Declared In
SFRestAPI.h
– compositeRequest:refIds:allOrNone:apiVersion:
Returns an SFRestRequest
object that executes a composite request.
- (SFRestRequest *)compositeRequest:(NSArray<SFRestRequest*> *)requests refIds:(NSArray<NSString*> *)refIds allOrNone:(BOOL)allOrNone apiVersion:(nullable NSString *)apiVersion
Parameters
requests |
Array of subrequests to execute. |
---|---|
refIds |
Array of reference IDs for the requests. The number of elements should match the number of requests. |
allOrNone |
Specifies whether to return partial results when an error occurs while processing a subrequest. |
apiVersion |
API version. |
Declared In
SFRestAPI.h
– requestForSObjectTree:objectTrees:apiVersion:
Returns an SFRestRequest
object that executes an sObject tree request.
- (SFRestRequest *)requestForSObjectTree:(NSString *)objectType objectTrees:(NSArray<SFSObjectTree*> *)objectTrees apiVersion:(nullable NSString *)apiVersion
Parameters
objectType |
Type of a Salesforce object. Example: “Account”. |
---|---|
objectTrees |
Array of sobject trees. |
apiVersion |
API version. |
Declared In
SFRestAPI.h
– requestForPrimingRecords:changedAfterTimestamp:apiVersion:
Returns an SFRestRequest
object for getting list of record related to offline briefcase
- (SFRestRequest *)requestForPrimingRecords:(nullable NSString *)relayToken changedAfterTimestamp:(nullable NSNumber *)timestamp apiVersion:(nullable NSString *)apiVersion
Parameters
relayToken |
Relay token (to get next page of results) |
---|---|
timestamp |
To only get ids of records that changed after given time - or nil |
apiVersion |
Salesforce API version. |
Declared In
SFRestAPI.h
– requestForCollectionCreate:records:apiVersion:
Returns an SFRestRequest
object for creating multiple records with fewer round trips
- (SFRestRequest *)requestForCollectionCreate:(BOOL)allOrNone records:(NSArray<NSDictionary*> *)records apiVersion:(nullable NSString *)apiVersion
Parameters
allOrNone |
Indicates whether to roll back the entire request when the creation of any object fails (true) or to continue with the independent creation of other objects in the request. |
---|---|
records |
Array of sObjects. |
apiVersion |
Salesforce API version. |
Declared In
SFRestAPI.h
– requestForCollectionRetrieve:objectIds:fieldList:apiVersion:
Returns an SFRestRequest
object for retrieving multiple records with fewer round trips
- (SFRestRequest *)requestForCollectionRetrieve:(NSString *)objectType objectIds:(NSArray<NSString*> *)objectIds fieldList:(NSArray<NSString*> *)fieldList apiVersion:(nullable NSString *)apiVersion
Parameters
objectType |
Type of the requested record. |
---|---|
objectIds |
Array of Salesforce IDs of the requested records. |
fieldList |
Array of requested field names. |
apiVersion |
Salesforce API version. |
Declared In
SFRestAPI.h
– requestForCollectionUpdate:records:apiVersion:
Returns an SFRestRequest
object for updating multiple records with fewer round trips
- (SFRestRequest *)requestForCollectionUpdate:(BOOL)allOrNone records:(NSArray<NSDictionary*> *)records apiVersion:(nullable NSString *)apiVersion
Parameters
allOrNone |
Indicates whether to roll back the entire request when the update of any object fails (true) or to continue with the independent update of other objects in the request. |
---|---|
records |
Array of sObjects. |
apiVersion |
Salesforce API version. |
Declared In
SFRestAPI.h
– requestForCollectionUpsert:objectType:externalIdField:records:apiVersion:
Returns an SFRestRequest
object for upserting multiple records with fewer round trips
- (SFRestRequest *)requestForCollectionUpsert:(BOOL)allOrNone objectType:(NSString *)objectType externalIdField:(NSString *)externalIdField records:(NSArray<NSDictionary*> *)records apiVersion:(nullable NSString *)apiVersion
Parameters
allOrNone |
Indicates whether to roll back the entire request when the upsert of any object fails (true) or to continue with the independent upsert of other objects in the request. |
---|---|
objectType |
Type of the requested record. |
externalIdField |
Name of ID field in source data. |
records |
Array of sObjects. |
apiVersion |
Salesforce API version. |
Declared In
SFRestAPI.h
– requestForCollectionDelete:objectIds:apiVersion:
Returns an SFRestRequest
object for deleting multiple records with fewer round trips
- (SFRestRequest *)requestForCollectionDelete:(BOOL)allOrNone objectIds:(NSArray<NSString*> *)objectIds apiVersion:(nullable NSString *)apiVersion
Parameters
allOrNone |
Indicates whether to roll back the entire request when the delete of any object fails (true) or to continue with the independent delete of other objects in the request. |
---|---|
objectIds |
List of Salesforce IDs of the records to delete. |
apiVersion |
Salesforce API version. |
Declared In
SFRestAPI.h
Other utility methods
+ userAgentString
Provides the User-Agent string used by Mobile SDK.
+ (NSString *)userAgentString
Declared In
SFRestAPI.h
+ userAgentString:
- Returns the User-Agent string used by Mobile SDK, adding the qualifier after the app type.
+ (NSString *)userAgentString:(NSString *)qualifier
Parameters
qualifier |
Optional subtype of native or hybrid Mobile SDK app. |
---|
Declared In
SFRestAPI.h
Notifications Methods
– requestForNotificationsStatus:
Returns a request to fetch the status of notifications, including unread and unseen count.
- (SFRestRequest *)requestForNotificationsStatus:(NSString *)apiVersion
Parameters
apiVersion |
API version. |
---|
Declared In
SFRestAPI+Notifications.h
– requestForNotification:apiVersion:
Returns a request to fetch the given notification.
- (SFRestRequest *)requestForNotification:(NSString *)notificationId apiVersion:(NSString *)apiVersion
Parameters
notificationId |
ID of notification to fetch. |
---|---|
apiVersion |
API version. |
Declared In
SFRestAPI+Notifications.h
Extension Methods
activeRequests
Active requests property.
@property (nonatomic, readonly, strong, nonnull) SFSDKSafeMutableSet *activeRequests
Declared In
SFRestAPI+Internal.h
instrumentationDelegateInternal
@property (nullable, nonatomic, strong) id<SFRestRequestDelegate> instrumentationDelegateInternal
– forceTimeoutRequest:
Force a request to timeout: for testing only!
- (BOOL)forceTimeoutRequest:(nonnull SFRestRequest *)req
Parameters
req |
The request to force a timeout on, or nil to grab any active request and force it to timeout |
---|
Return Value
YES if we were able to find and timeout the request, NO if the request could not be found
Declared In
SFRestAPI+Internal.h
Files Methods
– requestForOwnedFilesList:page:apiVersion:
Build a Request that can fetch a page from the files owned by the specified user.
- (SFRestRequest *)requestForOwnedFilesList:(nullable NSString *)userId page:(NSUInteger)page apiVersion:(nullable NSString *)apiVersion
Parameters
userId |
if nil the context user is used, otherwise it should be an Id of a user. |
---|---|
page |
if nil fetches the first page, otherwise fetches the specified page. |
apiVersion |
API version. |
Return Value
A new SFRestRequest that can be used to fetch this data.
Declared In
SFRestAPI+Files.h
– requestForFilesInUsersGroups:page:apiVersion:
Build a Request that can fetch a page from the list of files from groups that the user is a member of.
- (SFRestRequest *)requestForFilesInUsersGroups:(nullable NSString *)userId page:(NSUInteger)page apiVersion:(nullable NSString *)apiVersion
Parameters
userId |
if nil the context user is used, otherwise it should be an Id of a user. |
---|---|
page |
if nil fetches the first page, otherwise fetches the specified page. |
apiVersion |
API version. |
Return Value
A new SFRestRequest that can be used to fetch this data.
Declared In
SFRestAPI+Files.h
– requestForFilesSharedWithUser:page:apiVersion:
Build a Request that can fetch a page from the list of files that have been shared with the user.
- (SFRestRequest *)requestForFilesSharedWithUser:(nullable NSString *)userId page:(NSUInteger)page apiVersion:(nullable NSString *)apiVersion
Parameters
userId |
if nil the context user is used, otherwise it should be an Id of a user. |
---|---|
page |
if nil fetches the first page, otherwise fetches the specified page. |
apiVersion |
API version. |
Return Value
A new SFRestRequest that can be used to fetch this data.
Declared In
SFRestAPI+Files.h
– requestForFileDetails:forVersion:apiVersion:
Build a Request that can fetch the file details of a particular version of a file.
- (SFRestRequest *)requestForFileDetails:(NSString *)sfdcId forVersion:(nullable NSString *)version apiVersion:(nullable NSString *)apiVersion
Parameters
sfdcId |
The Id of the file |
---|---|
version |
if nil fetches the most recent version, otherwise fetches this specific version. |
apiVersion |
API version. |
Return Value
A new SFRestRequest that can be used to fetch this data.
Declared In
SFRestAPI+Files.h
– requestForBatchFileDetails:apiVersion:
Build a request that can fetch the latest file details of one or more files in a single request.
- (SFRestRequest *)requestForBatchFileDetails:(NSArray<NSString*> *)sfdcIds apiVersion:(nullable NSString *)apiVersion
Parameters
sfdcIds |
The list of file Ids to fetch. |
---|---|
apiVersion |
API version. |
Return Value
A new SFRestRequest that can be used to fetch this data
Declared In
SFRestAPI+Files.h
– requestForFileRendition:version:renditionType:page:apiVersion:
Build a Request that can fetch the a preview/rendition of a particular page of the file (and version).
- (SFRestRequest *)requestForFileRendition:(NSString *)sfdcId version:(nullable NSString *)version renditionType:(NSString *)renditionType page:(NSUInteger)page apiVersion:(nullable NSString *)apiVersion
Parameters
sfdcId |
The Id of the file. |
---|---|
version |
if nil fetches the most recent version, otherwise fetches this specific version |
renditionType |
What format of rendition do you want to get |
page |
which page to fetch, pages start at 0. |
apiVersion |
API version. |
Return Value
A new SFRestRequest that can be used to fetch this data.
Declared In
SFRestAPI+Files.h
– requestForFileContents:version:apiVersion:
Builds a request that can fetch the actual binary file contents of this particular file.
- (SFRestRequest *)requestForFileContents:(NSString *)sfdcId version:(nullable NSString *)version apiVersion:(nullable NSString *)apiVersion
Parameters
sfdcId |
The Id of the file. |
---|---|
version |
The version of the file. |
apiVersion |
API version. |
Return Value
A new SFRestRequest that can be used to fetch this data.
Declared In
SFRestAPI+Files.h
– requestForFileShares:page:apiVersion:
Build a request that can fetch a page from the list of entities that this file is shared to.
- (SFRestRequest *)requestForFileShares:(NSString *)sfdcId page:(NSUInteger)page apiVersion:(nullable NSString *)apiVersion
Parameters
sfdcId |
The Id of the file. |
---|---|
page |
if nil fetches the first page, otherwise fetches the specified page. |
apiVersion |
API version. |
Return Value
A new SFRestRequest that can be used to fetch this data.
Declared In
SFRestAPI+Files.h
– requestForAddFileShare:entityId:shareType:apiVersion:
Build a request that will add a file share for the specified fileId to the specified entityId.
- (SFRestRequest *)requestForAddFileShare:(NSString *)fileId entityId:(NSString *)entityId shareType:(NSString *)shareType apiVersion:(nullable NSString *)apiVersion
Parameters
fileId |
the Id of the file being shared. |
---|---|
entityId |
the Id of the entity to share the file to (e.g. a user or a group). |
shareType |
the type of share (V - View, C - Collaboration). |
apiVersion |
API version. |
Return Value
A new SFRestRequest that be can used to create this share.
Declared In
SFRestAPI+Files.h
– requestForDeleteFileShare:apiVersion:
Build a request that will delete the specified file share.
- (SFRestRequest *)requestForDeleteFileShare:(NSString *)shareId apiVersion:(nullable NSString *)apiVersion
Parameters
shareId |
The Id of the file share record (aka ContentDocumentLink). |
---|---|
apiVersion |
API version. |
Return Value
A new SFRestRequest that can be used to delete this share.
Declared In
SFRestAPI+Files.h
– requestForUploadFile:name:description:mimeType:apiVersion:
Build a request that can upload a new file to the server, this will create a new file at version 1.
- (SFRestRequest *)requestForUploadFile:(NSData *)data name:(NSString *)name description:(NSString *)description mimeType:(NSString *)mimeType apiVersion:(nullable NSString *)apiVersion
Parameters
data |
Data to upload to the server. |
---|---|
name |
The name/title of this file. |
description |
A description of the file. |
mimeType |
The mime-type of the file, if known. |
apiVersion |
API version. |
Return Value
A SFRestRequest that can perform this upload.
Declared In
SFRestAPI+Files.h
– requestForProfilePhotoUpload:fileName:mimeType:userId:apiVersion:
Build a request that can upload a new profile photo to the server
- (SFRestRequest *)requestForProfilePhotoUpload:(NSData *)data fileName:(NSString *)fileName mimeType:(NSString *)mimeType userId:(NSString *)userId apiVersion:(nullable NSString *)apiVersion
Parameters
data |
Data to upload to the server. |
---|---|
fileName |
The name of this file. |
mimeType |
The mime-type of the file, if known. |
userId |
The id of the user to update. |
apiVersion |
API version. |
Return Value
A SFRestRequest that can perform this upload.
Declared In
SFRestAPI+Files.h
QueryBuilder Methods
+ sanitizeSOSLSearchTerm:
The search term to be sanitized.
+ (NSString *)sanitizeSOSLSearchTerm:(NSString *)searchTerm
Parameters
searchTerm |
The search term to be sanitized. |
---|
Return Value
SOSL-safe version of search term
Declared In
SFRestAPI+QueryBuilder.h
+ SOSLSearchWithSearchTerm:objectScope:
Generate a SOSL search.
+ (nullable NSString *)SOSLSearchWithSearchTerm:(NSString *)term objectScope:(nullable NSDictionary<NSString*,NSString*> *)objectScope
Parameters
term |
|
---|---|
objectScope |
|
Return Value
query or nil if a query could not be generated
Declared In
SFRestAPI+QueryBuilder.h
+ SOSLSearchWithSearchTerm:fieldScope:objectScope:limit:
Generate a SOSL search.
+ (nullable NSString *)SOSLSearchWithSearchTerm:(NSString *)term fieldScope:(nullable NSString *)fieldScope objectScope:(nullable NSDictionary<NSString*,NSString*> *)objectScope limit:(NSInteger)limit
Parameters
term |
|
---|---|
fieldScope |
|
objectScope |
|
limit |
|
Return Value
query or nil if a query could not be generated
Declared In
SFRestAPI+QueryBuilder.h
+ SOQLQueryWithFields:sObject:whereClause:limit:
Generate a SOQL query.
+ (nullable NSString *)SOQLQueryWithFields:(NSArray<NSString*> *)fields sObject:(NSString *)sObject whereClause:(nullable NSString *)whereClause limit:(NSInteger)limit
Parameters
fields |
|
---|---|
sObject |
|
whereClause |
|
limit |
|
Return Value
query or nil if a query could not be generated
Declared In
SFRestAPI+QueryBuilder.h
+ SOQLQueryWithFields:sObject:whereClause:groupBy:having:orderBy:limit:
Generate a SOQL query.
+ (nullable NSString *)SOQLQueryWithFields:(NSArray<NSString*> *)fields sObject:(NSString *)sObject whereClause:(nullable NSString *)whereClause groupBy:(nullable NSArray<NSString*> *)groupBy having:(nullable NSString *)having orderBy:(nullable NSArray<NSString*> *)orderBy limit:(NSInteger)limit
Parameters
fields |
|
---|---|
sObject |
|
whereClause |
|
groupBy |
|
having |
|
orderBy |
|
limit |
|
Return Value
query or nil if a query could not be generated
Declared In
SFRestAPI+QueryBuilder.h
Blocks Methods
+ errorWithDescription:
Creates an error object with the given description.
+ (NSError *)errorWithDescription:(NSString *)description
Parameters
description |
Description |
---|
Declared In
SFRestAPI+Blocks.h
– sendRequest:failureBlock:successBlock:
Sends a request you’ve already built, using blocks to return status.
- (void)sendRequest:(SFRestRequest *)request failureBlock:(SFRestRequestFailBlock)failureBlock successBlock:(SFRestResponseBlock)successBlock
Parameters
request |
SFRestRequest to be sent. |
---|---|
failureBlock |
Block to be executed when the request fails (timeout, cancel, or error). |
successBlock |
Block to be executed when the request successfully completes. |
Declared In
SFRestAPI+Blocks.h
– sendCompositeRequest:failureBlock:successBlock:
Sends a request you’ve already built, using blocks to return status.
- (void)sendCompositeRequest:(SFSDKCompositeRequest *)request failureBlock:(SFRestRequestFailBlock)failureBlock successBlock:(SFRestCompositeResponseBlock)successBlock
Parameters
request |
Composite request to be sent. |
---|---|
failureBlock |
Block to be executed when the request fails (timeout, cancel, or error). |
successBlock |
Block to be executed when the request successfully completes. |
Declared In
SFRestAPI+Blocks.h
– sendBatchRequest:failureBlock:successBlock:
Sends a request you’ve already built, using blocks to return status.
- (void)sendBatchRequest:(SFSDKBatchRequest *)request failureBlock:(SFRestRequestFailBlock)failureBlock successBlock:(SFRestBatchResponseBlock)successBlock
Parameters
request |
Batch request to be sent. |
---|---|
failureBlock |
Block to be executed when the request fails (timeout, cancel, or error). |
successBlock |
Block to be executed when the request successfully completes. |
Declared In
SFRestAPI+Blocks.h