function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
king kpking kp 

how to Excute this class please help me

Hi to all,
How to Excute this class please help me

@RestResource(urlMapping='/Merchandise/*')
global with sharing class MerchandiseManager {
    @HttpGet
    global static Account getMerchandiseById() {
        RestRequest req = RestContext.request;
        String merchId = req.requestURI.substring(
        req.requestURI.lastIndexOf('/')+1);
        Account result =
        [SELECT Name,NumberofLocations__c,DunsNumber,Description
        FROM Account];
        return result;
    }
    @HttpPost
    global static String createMerchandise(String name,
        String description, Decimal price, Double inventory) {
        Account m = new Account(
        Name=name,
        Description=description,
        NumberofLocations__c=price);
        //DunsNumber=inventory);
        insert m;
        return m.Id;
    }
    
}


thanks
kullaia
Amit Chaudhary 8Amit Chaudhary 8
you can execute the above class with the help of workbench. Please check below post for screen shot and step by step process
1) http://amitsalesforce.blogspot.com/2016/06/rest-explorer-using-workbench-execute.html
2) http://amitsalesforce.blogspot.com/search/label/Rest%20API
3) http://amitsalesforce.blogspot.com/2016/04/rest-api-in-salesforce-execute-rest-api.html

Let us know if this will help you