+ Start a Discussion
Ghulam ChaudharyGhulam Chaudhary 

Create an API

Hi everyone,

Its my first time when I am creating an REST API to create a case from a third party application( MyItemApp) based on MyItemApp's Fields (like Item Id,Merchant Id). 
When we get Item Id and Merchant Id it will create a case in salesforce.

my code is below but I am unable to do it please help me.... 


global class Paytm_SellerPanel_CaseCreation{
global static string message;
global static string Paytm_SellerPanel_CaseCreation()

    RestRequest req = RestContext.request;
    RestResponse res = Restcontext.response;

    string RespBody=RestContext.request.requestBody.tostring().trim();
    system.debug('respbody    '+respbody);

    records deserializedBody =(records)JSON.deserialize(RespBody, records.class);
    system.debug('deserializedBody  '+deserializedBody);
    system.debug('message new'+message);
    return message;
global class records{
    public string timestamp{get;set;}
    public String addcat_id{get;set;}
    public list<fields> fields{get;set;}
    public string merchant_id{get;set;}
    public string item_id{get;set;}

public List<fields> fields;

public class fields
    public string ApiName{get;set;}
    public string label{get;set;}
    public string value{get;set;}
    public string datatype{get;set;}

public static string createcase(records CasRecords) 
    string uploadOn='';
   // string message;
    string out='true';
    string chk='';
    string teamName='';
    string TemplateName='';
    boolean CaseMgm=true;
    system.debug('CasRecords   '+CasRecords);
please help me if possible