RestRequest

open class RestRequest

RestRequest: Class to represent any REST request. The class offers factory methods to build RestRequest objects for all REST API actions:

  • userinfo
  • tokeninfo
  • singleaccess
  • versions
  • resources
  • describeGlobal
  • metadata
  • describe
  • create
  • retrieve
  • upsert
  • update
  • delete
  • query
  • search
  • searchScopeAndOrder
  • searchResultLayout
  • objectLayout
  • composite
  • batch
  • tree
  • notifications
  • priming records
  • sobject collection create
  • sobject collection retrieve
  • sobject collection update
  • sobject collection upsert
  • sobject collection delete
It also has constructors to build any arbitrary request.

Inheritors

Constructors

Link copied to clipboard
constructor(method: RestRequest.RestMethod, path: String)
Generic constructor for arbitrary requests without a body.
constructor(method: RestRequest.RestMethod, path: String, additionalHttpHeaders: Map<String, String>)
Generic constructor for arbitrary requests without a body.
constructor(method: RestRequest.RestMethod, path: String, requestBody: RequestBody)
Generic constructor for arbitrary requests.
constructor(method: RestRequest.RestMethod, path: String, requestBodyAsJson: JSONObject)
Generic constructor for arbitrary requests.
constructor(method: RestRequest.RestMethod, path: String, requestBody: RequestBody, additionalHttpHeaders: Map<String, String>)
Generic constructor for arbitrary requests.
constructor(method: RestRequest.RestMethod, path: String, requestBodyAsJson: JSONObject, additionalHttpHeaders: Map<String, String>)
Generic constructor for arbitrary requests.
constructor(method: RestRequest.RestMethod, endpoint: RestRequest.RestEndpoint, path: String, requestBody: RequestBody, additionalHttpHeaders: Map<String, String>)
Generic constructor for arbitrary requests.
constructor(method: RestRequest.RestMethod, endpoint: RestRequest.RestEndpoint, path: String, requestBodyAsJson: JSONObject, additionalHttpHeaders: Map<String, String>)
Generic constructor for arbitrary requests.

Types

Link copied to clipboard
Enumeration for all REST API endpoints.
Link copied to clipboard
Enumeration for all HTTP methods.
Link copied to clipboard
open class SObjectTree
Helper class for getRequestForSObjectTree.

Properties

Link copied to clipboard
Link copied to clipboard
val ALL_OR_NONE: String = "allOrNone"
Link copied to clipboard
val ATTRIBUTES: String = "attributes"
Link copied to clipboard
val BATCH_REQUESTS: String = "batchRequests"
Link copied to clipboard
val BATCH_SIZE_OPTION: String = "batchSize"
Link copied to clipboard
val BODY: String = "body"
Link copied to clipboard
val COMPOSITE_REQUEST: String = "compositeRequest"
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val HALT_ON_ERROR: String = "haltOnError"
Link copied to clipboard
HTTP date format
Link copied to clipboard
val HTTP_HEADERS: String = "httpHeaders"
Link copied to clipboard
val IF_UNMODIFIED_SINCE: String = "If-Unmodified-Since"
Link copied to clipboard
Salesforce timestamp format.
Link copied to clipboard
val MAX_BATCH_SIZE: Int = 2000
Link copied to clipboard
Link copied to clipboard
application/x-www-form-urlencoded media type
Link copied to clipboard
val MEDIA_TYPE_JSON: MediaType
application/json media type
Link copied to clipboard
val METHOD: String = "method"
Link copied to clipboard
Link copied to clipboard
val MIN_BATCH_SIZE: Int = 200
Link copied to clipboard
Link copied to clipboard
val RECORDS: String = "records"
Misc keys appearing in requests
Link copied to clipboard
val REFERENCE_ID: String = "referenceId"
Link copied to clipboard
val requestBody: RequestBody
Link copied to clipboard
Link copied to clipboard
val RICH_INPUT: String = "richInput"
Link copied to clipboard
val SERVICES_DATA: String = "/services/data/"
Link copied to clipboard
val SERVICES_OAUTH2: String = "/services/oauth2/"
Link copied to clipboard
val SFORCE_QUERY_OPTIONS: String = "Sforce-Query-Options"
Link copied to clipboard
val TYPE: String = "type"
Link copied to clipboard
val URL: String = "url"
Link copied to clipboard
utf_8 charset

Functions

Link copied to clipboard
open fun getBatchRequest(apiVersion: String, haltOnError: Boolean, requests: List<RestRequest>): BatchRequest
Batch request
Link copied to clipboard
open fun getCheapRequest(apiVersion: String): RestRequest
Cheap request to re-hydrate access token
Link copied to clipboard
open fun getCompositeRequest(apiVersion: String, allOrNone: Boolean, refIdToRequests: LinkedHashMap<String, RestRequest>): CompositeRequest
Composite request
Link copied to clipboard
open fun getRequestForCollectionCreate(apiVersion: String, allOrNone: Boolean, records: JSONArray): RestRequest
Request for creating multiple records with fewer round trips
Link copied to clipboard
open fun getRequestForCollectionDelete(apiVersion: String, allOrNone: Boolean, objectIds: List<String>): RestRequest
Request for deleting multiple records with fewer round trips
Link copied to clipboard
open fun getRequestForCollectionRetrieve(apiVersion: String, objectType: String, objectIds: List<String>, fieldList: List<String>): RestRequest
Request for retrieving multiple records with fewer round trips
Link copied to clipboard
open fun getRequestForCollectionUpdate(apiVersion: String, allOrNone: Boolean, records: JSONArray): RestRequest
Request for updating multiple records with fewer round trips
Link copied to clipboard
open fun getRequestForCollectionUpsert(apiVersion: String, allOrNone: Boolean, objectType: String, externalIdField: String, records: JSONArray): RestRequest
Request for upserting multiple records with fewer round trips
Link copied to clipboard
open fun getRequestForCreate(apiVersion: String, objectType: String, fields: Map<String, Any>): RestRequest
Request to create a record.
Link copied to clipboard
open fun getRequestForDelete(apiVersion: String, objectType: String, objectId: String): RestRequest
Request to delete a record.
Link copied to clipboard
open fun getRequestForDescribe(apiVersion: String, objectType: String): RestRequest
Request to completely describe the individual metadata at all levels for the specified object.
Link copied to clipboard
Request to list the available objects and their metadata for your organization's data.
Link copied to clipboard
open fun getRequestForLimits(apiVersion: String): RestRequest
Request for getting information about limits in your org
Link copied to clipboard
open fun getRequestForMetadata(apiVersion: String, objectType: String): RestRequest
Request to describe the individual metadata for the specified object.
Link copied to clipboard
open fun getRequestForNotification(apiVersion: String, notificationId: String): RestRequest
Request to get a notification.
Link copied to clipboard
open fun getRequestForNotifications(apiVersion: String, size: Integer, before: Date, after: Date): RestRequest
Request for getting notifications.
Link copied to clipboard
Request to get status of notifications for the user.
Link copied to clipboard
open fun getRequestForNotificationsUpdate(apiVersion: String, notificationIds: List<String>, before: Date, read: Boolean, seen: Boolean): RestRequest
Request for updating notifications.
Link copied to clipboard
open fun getRequestForNotificationUpdate(apiVersion: String, notificationId: String, read: Boolean, seen: Boolean): RestRequest
Request for updating a notification.
Link copied to clipboard
open fun getRequestForObjectLayout(apiVersion: String, objectAPIName: String, formFactor: String, layoutType: String, mode: String, recordTypeId: String): RestRequest
Request to get object layout data.
Link copied to clipboard
open fun getRequestForPrimingRecords(apiVersion: String, relayToken: String, changedAfterTime: Long): RestRequest
Request for getting list of record related to offline briefcase
Link copied to clipboard
open fun getRequestForQuery(apiVersion: String, q: String): RestRequest
open fun getRequestForQuery(apiVersion: String, q: String, batchSize: Int): RestRequest
Request to execute the specified SOQL query.
Link copied to clipboard
open fun getRequestForQueryAll(apiVersion: String, q: String): RestRequest
Request to execute the specified SOQL query which includes deleted records because of a merge or delete in the result set.
Link copied to clipboard
Request to list available resources for the specified API version, including resource name and URI.
Link copied to clipboard
open fun getRequestForRetrieve(apiVersion: String, objectType: String, objectId: String, fieldList: List<String>): RestRequest
Request to retrieve a record by object ID.
Link copied to clipboard
open fun getRequestForSearch(apiVersion: String, q: String): RestRequest
Request to execute the specified SOSL search.
Link copied to clipboard
open fun getRequestForSearchResultLayout(apiVersion: String, objectList: List<String>): RestRequest
Request to get search result layouts
Link copied to clipboard
Request to get search scope and order.
Link copied to clipboard
Request to generate URL to bridge into UI sessions (a front door URL) Applications should use that API instead of building front door URLs directly
Link copied to clipboard
open fun getRequestForSObjectTree(apiVersion: String, objectType: String, objectTrees: List<RestRequest.SObjectTree>): RestRequest
Request to create one or more sObject trees with root records of the specified type.
Link copied to clipboard
open fun getRequestForUpdate(apiVersion: String, objectType: String, objectId: String, fields: Map<String, Any>): RestRequest
open fun getRequestForUpdate(apiVersion: String, objectType: String, objectId: String, fields: Map<String, Any>, ifUnmodifiedSinceDate: Date): RestRequest
Request to update a record.
Link copied to clipboard
open fun getRequestForUpsert(apiVersion: String, objectType: String, externalIdField: String, externalId: String, fields: Map<String, Any>): RestRequest
Request to upsert (update or insert) a record.
Link copied to clipboard
Request to get information about the user making the request.
Link copied to clipboard
Request to get summary information about each Salesforce.com version currently available.
Link copied to clipboard
open fun toString(): String