Working with Records

The examples in this section use REST API resources to create, retrieve, update, and delete records, along with other record-related operations.

  • Create a Record

    Use the sObject Basic Information resource to create new records. You supply the required field values in the request data, and send the request using the POST HTTP method. The response body contains the ID of the new record if the call is successful.

  • Update a Record

    You use the sObject Rows resource to update records. Provide the updated record information in your request data and use the PATCH method of the resource with a specific record ID to update that record. Records in a single file must be of the same object type.

  • Delete a Record

    Use the sObject Rows resource to delete records. Specify the record ID and use the DELETE method of the resource to delete a record.

  • Get Field Values from a Standard Object Record

    You use the GET method of the sObject Rows resource to retrieve field values from a record.

  • Get Field Values from an External Object Record by Using the Salesforce ID

    You use the sObject Rows resource to retrieve field values from a record. Specify the fields you want to retrieve in the fields parameter and use the GET method of the resource.

  • Get Field Values from an External Object Record by Using the External ID Standard Field

    You use the sObject Rows resource to retrieve field values from a record. Specify the fields you want to retrieve in the fields parameter and use the GET method of the resource.

  • Get a Record Using an External ID

    You can use the GET method of the sObject Rows by External ID resource to get records with a specific external ID.

  • Insert or Update (Upsert) a Record Using an External ID

    You can use the sObject Rows by External ID resource to create records or update existing records (upsert) based on the value of a specified external ID field.

  • Traverse Relationships with Friendly URLs

    You can traverse relationship fields in standard and custom objects by constructing friendly URLs using the sObject Relationship resource. This approach allows you to directly access records associated by relationships. Using friendly URLs is an easier alternative to accessing records by obtaining object IDs from relationship fields and then inspecting the associated object ID record.

  • Get a List of Deleted Records Within a Given Timeframe

    Use the sObject Get Deleted resource to get a list of deleted records for the specified object. Specify the date and time range within which the records for the given object were deleted. Deleted records are written to a delete log (that is periodically purged), and will be filtered out of most operations, such as sObject Rows or Query (although QueryAll will include deleted records in results).

  • Get a List of Updated Records Within a Given Timeframe

    Use the sObject Get Updated resource to get a list of updated (modified or added) records for the specified object. Specify the date and time range within which the records for the given object were updated.