# How to invoke custom REST APIs on Salesforce

**URL:** <https://community.synatic.com/t/how-to-invoke-custom-rest-apis-on-salesforce/135>\
**Category:** Connections\
**Tags:** salesforce, helper-functions\
**Created:** [November 15, 2021, 11:05am UTC](https://community.synatic.com/t/how-to-invoke-custom-rest-apis-on-salesforce/135 "2021-11-15T11:05:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![navessa](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.synatic.com/navessa/32/58_2.png) [@navessa](https://community.synatic.com/u/navessa)\
**Post date:** [November 15, 2021, 11:05am UTC](https://community.synatic.com/t/how-to-invoke-custom-rest-apis-on-salesforce/135/1 "2021-11-15T11:05:47Z")

</div>

The Salesforce step uses a **standard** REST API path which is: /services/data/v52.0  
To invoke a **custom** REST API on Salesforce, you will need to add the Salesforce Apex step in the flow as shown below.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/3efb1c359e2fc764602018997def916ee9c412e5.png)

You first need to add a connection to Salesforce and then select the connection.  
In the Apex Path, you can add any query string parameter/ **any**  **path** but you must **exclude** the base URL of that path.  
You will only put in the path that is **after** the base URL and start with a forward slash as shown below.  
eg. URL path: [https://instanceName.my.salesforce.com/services/apexrestcall](https://instanceName.my.salesforce.com/services/apexrestcall)  
Path you will put: /apexrestcall

This will allow you to access the customized service that you connected to.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/8d617b11feef94f68c68253012c08132764e1891.png)

---

<div class="post-metadata">

**Author:** ![konradbeck](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@konradbeck](https://community.synatic.com/u/konradbeck)\
**Post date:** [January 11, 2022, 10:30am UTC](https://community.synatic.com/t/how-to-invoke-custom-rest-apis-on-salesforce/135/2 "2022-01-11T10:30:41Z")

</div>

Is there a way to pass variables to the query string?

for instance:

/apexrestcall/{{originalRecord.Id}}

---

<div class="post-metadata">

**Author:** ![navessa](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.synatic.com/navessa/32/58_2.png) [@navessa](https://community.synatic.com/u/navessa)\
**Post date:** [January 11, 2022, 10:39am UTC](https://community.synatic.com/t/how-to-invoke-custom-rest-apis-on-salesforce/135/3 "2022-01-11T10:39:20Z")

</div>

Hi Konrad,

There is. The below link will assist to how you can pass a variable to the query string.

> [@How to reference a record value in an API URL](https://community.synatic.com/t/how-to-reference-a-record-value-in-an-api-url/145):
>
> In order to reference or call a record value from your API URL in the HTTP Service step, you need to add “{@record.id}” in your API URL as highlighted below. It will return all the records from the API that you created. [image] [How to add a return limit variable in an API URL](https://community.synatic.com/t/how-to-add-a-return-limit-variable-in-an-api-url/188)

i.e. /apexrestcall/ {@record.id}
