Webservice and Callout using REST API for Salesforce – Coderinme

If you want to connect two devices or software over a network (world wide web), then you will need some web service that will help you to connect them.There are two popular services that is used for Webservice  and Callout that is:

  • SOAP(simple object access protocol.)
  • REST (Representational state transition)

Webservice  and Callout

for any API the structure looks like the following.


anyone or multiple of the following in header

  • Access token
  • username,
  • password
  • certificate
  • content-type

Method  type : GET/POST/PUT/DELETE

Body: it may be (json/xml/ app-form-data) blank in case of GET

If we want to connect some app or software with salesforce, like we want to send some data from salesforce to SAP then we will write a webservice (API) for that.

In this what we will actually do we will create a new remote site setting, in which we will enter the details of URL which we want to hit through API, make sure if there is any port number in API make sure to put that also.

Webservice and Callout using REST API for Salesforce - Coderinme

If someone app/software wants to connect then we will give them access token, url and login credential, we will also write a service callout that will redirect that URL and give them what they want.

For that purpose we will do these steps in salesforce.

  1. we will create a new  connected App, give that a name, email Id, and a site URL for callout URL,
  2. enable OAUTH
  3.  give them access data API
  4. we will save it using continue

connected App

Now you can see client id, client secret , you will provide  it to that app developer

So that was the basic idea behind API introducion , we will understand the coding part in the next post.

How we will test an API.

You can use curl or POSTMAN or ARC(advance rest client ) a chrome extension

response code

200 OK connecting

400 bad request , your data, or password or something is wrong the data or format

500 – internal server error : that’s error of that software that you are using

403 : no access // forbidden

404 : wrong url /not found

you can see our video tutorial for the same.

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

A web developer(Front end and Back end), and DBA at csdamu.com. Currently working as Salesforce Developer @ Tech Matrix IT Consulting Private Limited. Check me @about.me/s.saifi

Leave a reply:

Your email address will not be published.