In Maven Tools, you can use the Rest Console to make requests to Salesforce using the Rest API. If you don't know much about Rest API, we recommend going through this guide from Salesforce, or completing this trail on Trailhead before you start using the Rest Console. On the other hand, if you're familiar with the concepts of Rest API, or if you have used other API-call based tools before, like Workbench Rest Explorer or Postman, using the Rest Console will be very easy for you.
You can access the Rest Console by clicking the Rest Console tab in Maven Tools. Let's have a quick overview of its features:
To show you how the rest console works, we're going to create a simple request to insert a new account. Here's what you need to do:
{
"Name" : "Test Account",
"Industry" : "Technology"
}
After sending the request, you should get a response body like this if everything went as planned:
{
"id": "someID",
"success": true,
"errors": []
}
You'll also get some additional details about the API call in the upper left part of the console, includng the response code, execution time and size.
Now that we have inserted our account, we can find it by executing a query. We can do that using the Rest Console as well:
You can save your request and then access it from the saved requests folder:
Your response body should now look like this:
{
"totalSize": 1,
"done": true,
"records": [
{
"attributes": {
"type": "Account",
"url": "/services/data/v49.0/sobjects/Account/someID"
},
"Id": "someID",
"Name": "Test Account",
"Industry": "Technology"
}
]
}
As you can see, the query returned our Test Account we just created. Since we created that account just for testing purposes, we can go on and delete it. We're going to do that by using the Rest API as well:
You won't get anything in the response body, but if you execute the query again you'll see that the record has now been deleted.
And with that, we showed you one of many functionalities that the Rest Console offers. You can check the examples in the Salesforce Rest API developer guide to check out what other things you can use the Rest API for.
Another great feature that the Rest Console provides you is to generate the code of your request in 27 different languages. When you click on the 'Generate Code' icon button in the controls section, a new modal will open with the list of supported languages. Just click on the language you want and the code will show up on the right.