You need to sign in to do that
Don't have an account?
Harsh Singh 7
Please share the test class for below code
Please create the test class for below code
@RestResource(urlMapping='/Subscriber/*')
global with sharing class MyFirstISID
{
@HttpGet
global static list<string> doGet()
{
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String strEncryptId = req.params.get('EncryptedSub_id');
Id decryptDataSub_id = Cipher.decryptData(String.valueof(strEncryptId ));
Account sampleJSON = [SELECT Id, Name,JSON__c FROM Account WHERE Name =: 'SUBSCRIBER' AND Id =: decryptDataSub_id ];
Object obj = JSON.deserializeUntyped(sampleJSON.JSONAttribute__c ); // converting JSON string into apex primitive data types.
}
return strRes;
}
@RestResource(urlMapping='/Subscriber/*')
global with sharing class MyFirstISID
{
@HttpGet
global static list<string> doGet()
{
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String strEncryptId = req.params.get('EncryptedSub_id');
Id decryptDataSub_id = Cipher.decryptData(String.valueof(strEncryptId ));
Account sampleJSON = [SELECT Id, Name,JSON__c FROM Account WHERE Name =: 'SUBSCRIBER' AND Id =: decryptDataSub_id ];
Object obj = JSON.deserializeUntyped(sampleJSON.JSONAttribute__c ); // converting JSON string into apex primitive data types.
}
return strRes;
}
I found the below link which I think could help you as a refernece to write a test class for the apex rest resource.
>> http://cloudyworlds.blogspot.com/2012/12/writing-test-classes-for-apex-rest.html
In case if this helped you can you please mark this as the best answer.
Regards,
Anutej