Page cover image

Salesforce

The simplest Salesforce API you have every seen!

Salesforce API proxy, get started in seconds without having to setup a connected app in Salesforce. No-code!

TL;DR

This API proxy lets you do any operation on your Salesforce data but removes from you all the complexity of setting up and using the classic Salesforce API 🤩

No need to worry about setting up a connected app, rotating the security token, using bulk API or not, record formatting and more! Everything is managed for you 💆‍♀️

Operations:

Regions 🌍

Depending on your region, you can use

🇪🇺 https://eu.api-proxy.stacksync.com/

🇺🇸 https://us.api-proxy.stacksync.com/

Insert

Insert up to 10 000 records with a single query. Simply supply the field values for each record you want to create. The response will contain one success confirmation per record meaning that, within the same request, each record can succeed or fail independently of each other. For each sent record, you will receive a detailed success or error message.

curl -X POST https://eu.api-proxy.stacksync.com/v1/object/insert/Account \
        -H "Authorization: Bearer your_api_proxy_service_token" \
        -H "Content-Type: application/json" \
        -d '{"data":[{"name": "John Doe"},{"name": "Jane Smith"}]}'

Example response body:

{
	"data": [
		{
			"errors": [],
			"id": "0010600002BpRZDAA3",
			"success": true
		},
		{
			"errors": [],
			"id": "0010600002BpRZEAA3",
			"success": true
		}
	]
}

Upsert

Create or update (upsert) up to one record per request based on a match_key which can be the record Id or any custom field.

  • If the key is not matched, then a new object record is created.

  • If the key is matched once, then the existing object record is updated.

  • If the key is matched multiple times, then an error is generated and the object record is neither inserted or updated.

curl -X POST https://eu.api-proxy.stacksync.com/v1/object/upsert/Account \
        -H "Authorization: Bearer your_api_proxy_service_token" \
        -H "Content-Type: application/json" \
        -d '{"data":[{"name":"Jon Doe"}],"match_key":"name"}'

Example response body:

{
	"data": [
		{	
			"errors": [],
			"id": "0010600002BpLWtAAN",
			"success": true
		}
	]
}

Update

Update up to 10 000 records per request. Existing field values in Salesforce will be overwritten with the new values provided.

curl -X POST https://eu.api-proxy.stacksync.com/v1/object/update/Account \
        -H "Authorization: Bearer your_api_proxy_service_token" \
        -H "Content-Type: application/json" \
        -d '{"data":[{"id": "0010600002BpLWtAAN", "name": "John Doe"}, {"id": "0010600002BpLWuAAN", "name": "Jane Smith"}]}'

Example response body:

{
	"data": [
		{
			"errors": [],
			"id": "0010600002BpLWtAAN",
			"success": true
		},
		{
			"errors": [],
			"id": "0010600002BpLWuAAN",
			"success": true
		}
	]
}

Delete

Delete up to 10 000 records per request.

curl -X POST https://eu.api-proxy.stacksync.com/v1/object/delete \
        -H "Authorization: Bearer your_api_proxy_service_token" \
        -H "Content-Type: application/json" \
        -d '{"data": {"ids":["0010600002BpLWtAAN","0010600002BpLWuAAN"]}}'

Example response body:

{
         "data": [
                  {
                     "id" : "0010600002BpLWtAAN",
                     "success" : true,
                     "errors" : [ ]
                  },
                  {
                     "id" : "0010600002BpLWuAAN",
                     "success" : true,
                     "errors" : [ ]
                  }
         ]
}

Get

Get the content of up to 10 000 records. The number of sObjects returned matches the number of Ids passed in the request.

You can pass the optional fields parameter (list of field names that you want to be returned for each record). If the list of fields is not passed or is empty "fields":[], all fields are returned.

curl -X POST https://eu.api-proxy.stacksync.com/v1/object/get/Account \
        -H "Authorization: Bearer your_api_proxy_service_token" \
        -H "Content-Type: application/json" \
        -d '{"data": {"ids": ["0010600002BpLWuAAN", "0010600002BpLWtAAN"], "fields": ["Name"]}}'

Example response body:

{
	"data": [
		{
			"Id": "0010600002BpLWuAAN",
			"Name": "John Doe",
			"attributes": {
				"type": "Account",
				"url": "/services/data/v57.0/sobjects/Account/0010600002BpLWuAAN"
			}
		},
		{
			"Id": "0010600002BpLWtAAN",
			"Name": "Jane Smith",
			"attributes": {
				"type": "Account",
				"url": "/services/data/v57.0/sobjects/Account/0010600002BpLWtAAN"
			}
		}
	]
}

SOQL

Executes an SOQL query on your Salesforce instance.

curl -X POST https://eu.api-proxy.stacksync.com/v1/object/soql \
        -H "Authorization: Bearer your_api_proxy_service_token" \
        -H "Content-Type: application/json" \
        -d '{"data": "SELECT Id, Name, Email FROM Contacts"}'

Describe Salesforce Instance

Retrieves metadata for the Salesforce instance, containing a list of every available objects.

curl -X POST https://eu.api-proxy.stacksync.com/v1/describe \
        -H "Authorization: Bearer your_api_proxy_service_token" \
        -H "Content-Type: application/json"

Describe Object

Retrieves the metadata for a specific Salesforce table.

curl -X POST https://eu.api-proxy.stacksync.com/v1/describe/{object_name} \
        -H "Authorization: Bearer your_api_proxy_service_token" \
        -H "Content-Type: application/json"

Add a custom field to a Salesforce object

Add a custom field to a Salesforce object. Standard and custom objects are supported

the required request body parameters are:

  • type the type of the custom field you wish to create

  • name the name of the custom field you wish to create

  • label the label associated to the custom field you wish to create

type can be any of the Fieldtypes presented here

Unless otherwise noted, all fields are creatable, filterable, and nillable.

some optional parameters may be required depending on the type, (eg: length is required when creating a custom field of type Text)

Learn more about the API behavior here.

curl -X POST https://eu.api-proxy.stacksync.com/v1/object/add_custom_field/{object_name} \
        -H "Authorization: Bearer your_api_proxy_service_token" \
        -H "Content-Type: application/json" \
        -d '{"data": {"name": "field_name", "type": "field_type", "label": "field_label"}}'

Example Response Body:

{
    "data": {
        "errors": [],
        "id": "01N7R00000FlUGDUA3",
        "infos": [],
        "success": true,
        "warnings": []
    },
    "msg": "custom field added successfully"
}

Example requests for different field types:

curl -X POST https://eu.api-proxy.stacksync.com/v1/object/add_custom_field/{object_name} \
        -H "Authorization: Bearer *****" \
        -H "Content-Type: application/json" \
        -d '{"data": 
                {"name": "field_name", 
                "type": "Text", 
                "label": "list_field", 
                "length":100}}'

When a custom field is created, it is by default not visible to all profiles of the Salesforce organization. Users with different roles cannot see the newly created custom field.

The Field-Level Security needs to be modified after the Custom Field is created to enable other Salesforce profiles to see the field. Stacksync enables Custom Field Visibility for the following profiles:

  • System Administrator

  • Standard User

How to enable custom field for other profiles:

  1. Click on Setup

  2. Go to Object Manager

  3. Select the related Object

  1. Select Fields & Relationships

  1. Select the Custom Field

  1. Select Field-Level Security & make it visible to the user groups you want

To make the custom Field visible in a layout:

  1. Click on Setup

  2. Go to Object Manager

  3. Select the related Object

  4. Go to the Page Layout section

  5. Select and edit the Layout you want to include the custom field you have just created

Pass Through

Make a request to any Salesforce API by providing the URL, Request Method and the Request Body.

A request will be sent to the URL provided using the request method and request body. The request body can be empty.

curl -X [GET | POST | PUT | PATCH | DELETE] 
https://eu.api-proxy.stacksync.com/v1/proxy/INSERT_REQUEST_URL_HERE \
-H "Authorization: Bearer your_api_proxy_service_token" \
-d 'Optional'

Example request:

Get Account Record

curl -X GET https://eu.api-proxy.stacksync.com/v1/proxy/https://MyDomainName.my.salesforce.com/services/data/v60.0/sobjects/Account/0017S00000GYoL3QAL \
        -H "Authorization: Bearer your_api_proxy_service_token"        

Example response:

{
	"AccountNumber": "CD355118",
	"AccountSource": null,
	"Active__c": "Yes",
	"AnnualRevenue": 5600000000.0,
	"BillingAddress": {
		"city": "New York",
		"country": "test",
		"geocodeAccuracy": null,
		"latitude": 12.699999997,
		"longitude": 12.8,
		"postalCode": "123",
		"state": "NY",
		"street": "1301 Avenue of the Americas \nNew York, NY 10019\nUSA"
	},
	"BillingCity": "New York",
	"BillingCountry": "test",
	"BillingGeocodeAccuracy": null,
	"BillingLatitude": 12.699999997,
	"BillingLongitude": 12.8,
	"BillingPostalCode": "123",
	"BillingState": "NY",
	"BillingStreet": "1301 Avenue of the Americas \nNew York, NY 10019\nUSA",
	"CleanStatus": "Pending",
	"CreatedById": "0057S000000WzYEQA0",
	"CreatedDate": "2022-10-28T08:44:59.000+0000",
	"CustomerPriority__c": "High",
	"DandbCompanyId": null,
	"Description": "World's third largest oil and gas company.",
	"DunsNumber": null,
	"Fax": "(212) 842-5501",
	"Id": "0017S00000GYoL3QAL",
	"Industry": "Energy",
	"IsDeleted": false,
	"Jigsaw": null,
	"JigsawCompanyId": null,
	"LastActivityDate": null,
	"LastModifiedById": "0057S000000WzYEQA0",
	"LastModifiedDate": "2024-01-25T11:28:30.000+0000",
	"LastReferencedDate": "2024-02-12T01:58:55.000+0000",
	"LastViewedDate": "2024-02-12T01:58:55.000+0000",
	"MasterRecordId": null,
	"NaicsCode": null,
	"NaicsDesc": null,
	"Name": "Dickenson plc 2",
	"NumberOfEmployees": 145000,
	"NumberofLocations__c": 34.0,
	"OperatingHoursId": null,
	"OwnerId": "0057S000000WzYEQA0",
	"Ownership": "Public",
	"ParentId": null,
	"Phone": "12",
	"PhotoUrl": "/services/images/photo/0017S00000GYoL3QAL",
	"Rating": "Hot",
	"SLAExpirationDate__c": "2023-05-24",
	"SLASerialNumber__c": "6654",
	"SLA__c": "Platinum",
	"ShippingAddress": {
		"city": "Paris",
		"country": "France",
		"geocodeAccuracy": null,
		"latitude": null,
		"longitude": null,
		"postalCode": "75251",
		"state": "q",
		"street": "1301 Avenue of the Americas \nNew York, NY 10019\nUSA"
	},
	"ShippingCity": "Paris",
	"ShippingCountry": "France",
	"ShippingGeocodeAccuracy": null,
	"ShippingLatitude": null,
	"ShippingLongitude": null,
	"ShippingPostalCode": "75251",
	"ShippingState": "q",
	"ShippingStreet": "1301 Avenue of the Americas \nNew York, NY 10019\nUSA",
	"Sic": "4437",
	"SicDesc": null,
	"Site": "resr",
	"SystemModstamp": "2024-01-25T11:28:31.000+0000",
	"TickerSymbol": "UOS",
	"Tradestyle": null,
	"Type": "Customer - Direct",
	"UpsellOpportunity__c": "Yes",
	"Website": "http://www.uos.com",
	"YearStarted": null,
	"aaaa__c": null,
	"api_token_test__c": null,
	"attributes": {
		"type": "Account",
		"url": "/services/data/v60.0/sobjects/Account/0017S00000GYoL3QAL"
	},
	"encrypted_test__c": "XXXXXXXXXX",
	"formula_test__c": 5600145000.0,
	"geolocation_test__Latitude__s": 12.0,
	"geolocation_test__Longitude__s": 32.0,
	"geolocation_test__c": {
		"latitude": 12.0,
		"longitude": 32.0
	},
	"multipick_list__c": "string;string;12.541",
	"percent_test__c": 5.0,
	"picklisttestnow__c": null,
	"randomfield__c": null,
	"rich_text_test__c": null,
	"rollup_test__c": 720000.0,
	"test_custom_string5__c": "test",
	"time_test__c": "00:15:00.000Z",
	"url_test__c": "www.google.com"
}

Last updated