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 “http://cdnjs.cloudflare.com” 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 thoughts on “Salesforce REST API Playground”

  1. 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. 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. 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. 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. 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. 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…

  2. 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