Salesforce REST API Playground

What is REST API ?

In my words, Getting data from Other System or Same System using HTTP request is known as REST API.

If you know, how website works, you know REST API. Before REST API, there was SOAP request which needed lots of configuration and very tightly coupled. If you make any modification , you had to modify client side also by generating stubs / proxy classes again. There were many more disadvantages which got address by REST API. However, it doesn’t mean we don’t need SOAP.

Back to REST API, It is very simple to setup and almost any programming language can make HTTP request so very easy to get data from other source. Return type of REST API can be XML, Simple HTTP, JSON or any media like image. However, JSON is very popular response type amongst all.

In Past, I have already written one article demonstrating REST API usage.

How to use Salesforce REST API using JQuery in Visualforce ?

REST API Playground : I have created Simple Visualforce page, which demonstrates how to use REST API of Salesforce. It is written in Visualforce with the help of JQuery. You can study this code and play with it in your organization, you just need to copy and paste it.

You also need to add URL “” in Remote Site Settings, so that salesforce will allow Visualforce page to get JQuery library from CDN.

Video Demo :

REST API playground in Salesforce
REST API playground in Salesforce

Complete Visualforce page :




Related Posts


19 responses to “Salesforce REST API Playground”

  1. The Zhong ! Avatar
    The Zhong !

    You’re the MAN G2 !!! ^_^

  2. murali Avatar

    good stuff at one place.

  3. murali Avatar

    what might be the real business requirement to write this stuff on VF page…
    or for android app we might use REST API actions and q’s ?

    1. JitendraZaa Avatar

      There may be many scenario. Like, If you want to get data from Other Salesforce Org as explained here – or creating Mobile app which depends on JSON data, JSON can be returned from REST API’s

      1. murali Avatar

        thanks Jitendra.

        if i have given REST API instead of REST exposure from salesforce and barrier is oAuth without user name and password. how can we control data access like particular object and set of fields.

        1. JitendraZaa Avatar

          In that case, you have custom rest service. So , to access anything you have to rely within logic of custom rest service. Also, if you have oauth token then no need of username and pass word.

          1. murali Avatar

            ya …we can give custom rest class and Oauth with “access and manage your data”…if that person is trying to use REST API which is open and we can not able to see his operations and he can get data if he knows field api names and object of our org.

            in this case how can we control him

          2. JitendraZaa Avatar

            In that case, you have to right logic inside your apex class which is exposed as rest. Right logging mechanism to log their actions…

          3. murali Avatar

            but situation is different jitendra.
            suppose i have given custom rest class path and oAuth to java developer but he is using REST “API” (which is inbuilt for every salesforce org ) instead of my custom REST class with same oAuth which i have given earlier.

            in this case how we can control…

  4. Ganesh Veerla Avatar
    Ganesh Veerla

    Jitendra really this post is excellent.

  5. Vinay Naidu Avatar
    Vinay Naidu

    very nice article.

  6. ramesh Avatar

    this is not working in my visualforce page, how can i execute

    1. JitendraZaa Avatar

      Hi Ramesh,
      Please try again. Formatting issue were before here.

      1. reamesh Avatar

        Now it is working, Thank you Jitendra for this Post……..

  7. kanna Avatar

    how can u reduce the code ?

  8. kanna Avatar

    I mean how can you reduce the size of the code ?

  9. Mupiri Rakesh Avatar
    Mupiri Rakesh

    Can anyone help me, how to send a csv file in a Rest Request, using Apex Class or Trigger

  10. Selva Rathinam Avatar
    Selva Rathinam

    Really very nice…good stuff

  11. Selva Rathinam Avatar
    Selva Rathinam

    I have one Question ..what is the maximum size of file (Or Record)we can send through REST Service..?suppose the record size is 10k ,how can i achieve this?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading