Posts

Inbound API using Apex code

Image
In this tutorial, we will look at creating an endpoint for Inbound Salesforce API using Apex code. We will stick to a nice and easy simple example. Our endpoint will rely on the account object. We will have 3 methods associated with @HttpGet, @HttpPost, @HttpDelete Get method will return 6 accounts Post method creates a new account with name. Delete method will delete the individual account based on ID supplied. @RestResource(urlMapping ='/AccountInfo/*') Global class AccountInfo {     @httpget     global static List<account> GetAccount()     {         list<account> a = [select name from account limit 6];         return a;     }     @httppost     global static string PostNewAccount(string aName)     {         account a = new account();         a.name = aname;         insert a;         ret...

Inbound API's without using code

Image
Inbound APIs are used when you want to expose salesforce APIs to be consumed by the third-party provider. You can use code to write custom endpoints or you can use out of box salesforce API. This tutorial will only talk about non-code-based API development, in other words, we are going to rely on configuration instead of development. Step 1 ) Create a new connected app. You can do this going to setup-> App Manager-> New Connected App.  Step 2) Fill in  all mandatory fields as shown below. Step 3) Save the settings. It might take 2 to 3 minutes for this process. Step 4) Go to Setup- Connected App- Manage connected app and edit the app you have created just now. Set the timeout value under Session policies.  Step 5) Go to setup - App Manager and view this newly created app to retrieve Consumer key and Customer secret. Store them somewhere at a safe place. Step 6) Go to Profile-Settings-Reset Security Token and click on Reset security token button. You will be emailed ...