2

Can we use SoapUI to invoke Salesforce REST API? If so, please let me know how to do that. I have tried but getting error "Invalid Session Id".

Thanks.

4
  • Salesforce also provide WSDL file for SOAP API. Why don't you just use that? – Tushar Sharma Oct 10 '16 at 8:30
  • Sorry, I didnt get you, how to use SOAP WSDL to test Salesforce REST API? – Jaya Oct 10 '16 at 8:48
  • Not sure why you want to use SoapUI to test Salesforce Rest service, you can test it through workbench or any online rest explorer tool. – Raul Oct 10 '16 at 9:22
  • Is it not possible to test Salesforce REST API using SoapUI? Pleae let me know other common rest tools available. – Jaya Oct 10 '16 at 9:40
3

You can test REST API through Soap UI tool.

Before setting up a REST call to request a token in SoapUI, make sure you have an Connected App Created in the Salesforce Org and have latest version of SoapUI installed.

If you are new to Connected App, please find the details here.

  1. Create a Connected App

  2. Setup a Salesforce Connected Application

Steps to make the REST Call.

Step 1 - Set up a REST call to request a token in SoapUI

  1. In SoapUI Click File | New REST Project
  2. For the URL, enter "https://login.salesforce.com"
  3. In the top-left corner, change the method to POST from the default GET
  4. In the "Resource" section to the right of the Endpoint, enter, "/services/oauth2/token"
  5. Add these request parameters client_id = Consumer Key From Connected App , client_secret = Consumer Secret From Connected App, username = Salesforce Username , password = Salesforce Password and grant_type = password. The default value for the grant_type is password.
  6. Click Run. The output displays your access token to be used in future REST calls. enter image description here

Step 2 - Set up a REST call to request the REST API

Here I am using Salesforce default REST API (/services/data/v41.0/sobjects/Account/{Account Id}) to get the Account details.

  1. In the same project created above, right click and click "New REST Service From URI"
  2. For the URL, enter the URL received in the attribute "instance_url" from the earlier request (Step 1).
  3. In the "Resource" section to the right of the Endpoint, enter, "/services/data/v41.0/sobjects/Account/001i000000Z8Tze" Or whatever your REST API URL.
  4. In the top-left corner, make sure the method is selected as GET as it is a GET call for me.
  5. Add the "Authorization" header as Authorization: Bearer . Make sure there is a gap after "Bearer".
  6. Click Run. The output displays your Account Details.

enter image description here

1
  • Thanks for your response. It was very helpful. I enabled the permission "view and manage data via web" in the connected app. However, I can't get the REST API to work even after that. It appears that I need to enable "View All Data" permission for the API user in order to get the webservice to work. I am reluctant to enable the "View All Data" permission as it defeats the purpose of restricting the user to Contact object alone. – Balaji Pooruli Oct 24 '18 at 2:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.