You need to sign in to do that
Don't have an account?
![Lucas Wright 12 Lucas Wright 12](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
RestResource Class - Variable does not exist
Hello, I have a JSON2Apex Class to parse the JSON response for a web service but my REST Update class isn't working with it, i'm getting a variable does not exist error on id. It's probably something really simple but I've barely gotten my head around Hello World so far, if anyone has any suggestions?
Here's my PUT Class:
I can post the JSON2Apex if that's necessary but it's quite lengthy so didn't want to include if it wasn't necessary!
Here's my PUT Class:
@httpput global Static string fetchAccount(){ RestRequest req = RestContext.request; RestResponse res = Restcontext.response; string jsonString=req.requestBody.tostring(); JSON2Apex wResp=(JSON2Apex) JSON.deserialize(jsonString,JSON2Apex.class); Patient__c obj=new Patient__c(); obj=[select id from Patient where Id=:wResp.id]; update obj; return 'Success'; } global class JSON2Apex{ global string EMPI; }
I can post the JSON2Apex if that's necessary but it's quite lengthy so didn't want to include if it wasn't necessary!