Force.com REST API provides you with a powerful Web services API that you can use to interact with Force.com.
Each resource in REST API is a named URI that’s used with an HTTP method: HEAD, GET, POST, PATCH, or DELETE. All resources are accessed using a generic interface over HTTP with a base URI that follows your Force.com or Database.com URI. REST API supports authentication using OAuth 2.0 and supports both JSON and XML (JSON is the default).
To test the Salesforce Rest API. login to workbench. Navigate to utilities-> Rest Explorer and follow below examples to create/update/upsert/delete records.
Create a record:
Url:https://instance.salesforce.com/services/data/vNN.N/sobjects/sObject
Method:POST
Request Body:field-value pairs
eg:
Update a Record
Url:https://instance.salesforce.com/services/data/vNN.N/sobjects/sObject/Id
Method:PATCH
Request Body:field-value pairs
eg:
Upsert a Record
Url:https://instance.salesforce.com/services/data/vNN.N/sobjects/sObject/externalIdField/value Method:PATCH
Request Body:field-value pairs
eg:
https://instance.salesforce.com/services/data/vNN.N/sobjects/sObject/Id Method:DELETE
eg:
Each resource in REST API is a named URI that’s used with an HTTP method: HEAD, GET, POST, PATCH, or DELETE. All resources are accessed using a generic interface over HTTP with a base URI that follows your Force.com or Database.com URI. REST API supports authentication using OAuth 2.0 and supports both JSON and XML (JSON is the default).
To test the Salesforce Rest API. login to workbench. Navigate to utilities-> Rest Explorer and follow below examples to create/update/upsert/delete records.
Create a record:
Url:https://instance.salesforce.com/services/data/vNN.N/sobjects/sObject
Method:POST
Request Body:field-value pairs
eg:
url:https://ap1.salesforce.com/services/data/v37.0/sobjects/case Request Body:{ "Origin": "SMS Feedback", "Subject": "134350/Feedback", "Description": "Payment Type: Credit Card " }
Update a Record
Url:https://instance.salesforce.com/services/data/vNN.N/sobjects/sObject/Id
Method:PATCH
Request Body:field-value pairs
eg:
url:https://ap1.salesforce.com/services/data/v37.0/sobjects/case/500260000045ffRAAQ Request Body:{ "Origin": "SMS Feedback", "Subject": "134350/Feedback", "Description": "Payment Type: Credit Card " }
Upsert a Record
Url:https://instance.salesforce.com/services/data/vNN.N/sobjects/sObject/externalIdField/value Method:PATCH
Request Body:field-value pairs
eg:
url:https://ap1.salesforce.com/services/data/v37.0/sobjects/case/externalfield__c/54364 Request Body:{ "Origin": "SMS Feedback", "Subject": "134350/Feedback", "Description": "Payment Type: Credit Card " }Delete a Record
https://instance.salesforce.com/services/data/vNN.N/sobjects/sObject/Id Method:DELETE
eg:
url:https://ap1.salesforce.com/services/data/v37.0/sobjects/case/500260000045fesAAA