Package com.force.api
Class ForceApi
java.lang.Object
com.force.api.ForceApi
public class ForceApi extends Object
main class for making API calls.
This class is cheap to instantiate and throw away. It holds a user's session
as state and thus should never be reused across multiple user sessions,
unless that's explicitly what you want to do.
For web apps, you should instantiate this class on every request and feed it
the session information as obtained from a session cookie or similar. An
exception to this rule is if you make all API calls as a single API user.
Then you can keep a static reference to this class.
- Author:
- jjoergensen
-
Constructor Summary
Constructors Constructor Description ForceApi(ApiConfig apiConfig)ForceApi(ApiConfig config, ApiSession session)ForceApi(ApiSession session) -
Method Summary
-
Constructor Details
-
Method Details
-
getSession
-
curlHelper
-
get
-
delete
sends a custom REST API DELETE request- Parameters:
path- service path to be called - i.e. /process/approvals/- Returns:
- response from API wrapped in a ResourceRepresentation for multiple deserialization options. DELETE responses are generally empty, so you may get an error if you try to deserialize into a class by calling `as(...)` on ResourceRepresentation. The DELETE can be assumed to have succeeded if this method does not throw an exception.
-
post
sends a custom REST API POST request- Parameters:
path- service path to be called - i.e. /process/approvals/input- this object will be serialized as JSON and sent in tbe body of the request- Returns:
- response from API wrapped in a ResourceRepresentation for multiple deserialization options
-
put
sends a custom REST API PUT request (no test for this method yet).- Parameters:
path- service path to be called - i.e. /process/approvals/input- this object will be serialized as JSON and sent in tbe body of the request- Returns:
- response from API wrapped in a ResourceRepresentation for multiple deserialization options
-
patch
sends a custom REST API PATCH request- Parameters:
path- service path to be called - i.e. /process/approvals/input- this object will be serialized as JSON and sent in tbe body of the request- Returns:
- response from API wrapped in a ResourceRepresentation for multiple deserialization options
-
request
-
getIdentity
-
getSObject
- Throws:
ResourceException
-
createSObject
-
updateSObject
-
deleteSObject
-
createOrUpdateSObject
public CreateOrUpdateResult createOrUpdateSObject(String type, String externalIdField, String externalIdValue, Object sObject) -
query
-
query
-
queryMore
-
queryMore
-
queryAll
-
describeGlobal
-
getSupportedVersions
-
discoverSObject
-
describeSObject
-
describeSObjectIfModified
Retrieves all the metadata for an object, including information about each field, URLs, and child relationships. Response metadata will only be returned if the object metadata has changed since the provided date.- Parameters:
sobject- object namesince- date that is used to identify if metadata has been changed since- Returns:
- the metadata for an object, null if no changes since provided date
-