So, you built a REST API integration, wrote a test class to validate your code and everything seems to be fine with the test results and code coverage.
How do you test your code and actually see it generate the desired output?
Solution
Workbench.developerforce.com is a tool that can be used to test your API's.
Log in to the desired environment.
Click on Utilities---REST explorer.
Select the method for which you have built your API. For our purpose I am going to assume it is a GET method that was written.
So, select the HTTP method as GET and in the URL:
after entering /services/apexrest/
enter the name of the RESTResource (url mapping) as defined in the global class.
Let's call it CheckReq. Your URL should now look as follows:
/services/apexrest/CheckReq
Say within the global API you have a class called CheckReqProcessing then your URL should finally look like:
/services/apexrest/CheckReq/CheckReqProcessing; hit execute.
Get Method does not require an input so you should see the results of your API.
Your class code would be looking something like:
@RestResource(urlMapping='/CheckReq/*')
global with sharing class CheckReqProcessing {
@HttpGet
<<<Define Actions>>>>
}
Test Class Code:
Your test class code would need to have the following amongst all the all the things that it needs to be successfull:
RestRequest req = new RestRequest();
RestResponse res = new RestResponse();
req.requestURI = '/services/apexrest/CheckReq';
req.httpMethod = 'GET';
RestContext.request = req;
RestContext.response = res;
List<ObjjectName> CR = CheckReqProcessing.getUnsentCR();
How do you test your code and actually see it generate the desired output?
Solution
Workbench.developerforce.com is a tool that can be used to test your API's.
Log in to the desired environment.
Click on Utilities---REST explorer.
Select the method for which you have built your API. For our purpose I am going to assume it is a GET method that was written.
So, select the HTTP method as GET and in the URL:
after entering /services/apexrest/
enter the name of the RESTResource (url mapping) as defined in the global class.
Let's call it CheckReq. Your URL should now look as follows:
/services/apexrest/CheckReq
Say within the global API you have a class called CheckReqProcessing then your URL should finally look like:
/services/apexrest/CheckReq/CheckReqProcessing; hit execute.
Get Method does not require an input so you should see the results of your API.
Your class code would be looking something like:
@RestResource(urlMapping='/CheckReq/*')
global with sharing class CheckReqProcessing {
@HttpGet
<<<Define Actions>>>>
}
Test Class Code:
Your test class code would need to have the following amongst all the all the things that it needs to be successfull:
RestRequest req = new RestRequest();
RestResponse res = new RestResponse();
req.requestURI = '/services/apexrest/CheckReq';
req.httpMethod = 'GET';
RestContext.request = req;
RestContext.response = res;
List<ObjjectName> CR = CheckReqProcessing.getUnsentCR();
A nice article here, i think that people who have grown up with the idea of using computers are showing more responsibility towards writing posts that are thoughtful, do not have grammar mistakes and pertinent to the post..
ReplyDeleteSalesforce Training in Chennai
AWS Training in Chennai
ReplyDeleteThanks for the informative article. This is one of the best resources I have found in quite some time. Nicely written and great info. I really cannot thank you enough for sharing.
rpa training in bangalore
best rpa training in bangalore
RPA training in bangalore
rpa course in bangalore
rpa training in chennai
rpa online training
This comment has been removed by the author.
ReplyDeleteYour very own commitment to getting the message throughout came to be rather powerful and have consistently enabled employees just like me to arrive at their desired goals.
ReplyDeletepython interview questions and answers
python tutorials
python course institute in electronic city
Your new valuable key points imply much a person like me and extremely more to my office workers. With thanks; from every one of us.
ReplyDeletepython interview questions and answers
python tutorials
python course institute in electronic city
ReplyDeleteWhoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
AWS TRAINING IN BTM LAYOUT | AWS TRAINING IN BANGALORE
AWS Training in Marathahalli | AWS Training in Bangalore
ReplyDeleteWhoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
AWS TRAINING IN BTM LAYOUT | AWS TRAINING IN BANGALORE
AWS Training in Marathahalli | AWS Training in Bangalore
Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative.keep sharing!!!
ReplyDeleteAndroid Training in Chennai
Android Online Training in Chennai
Android Training in Bangalore
Android Training in Hyderabad
Android Training in Coimbatore
Android Training
Android Online Training
I just recently discovered your blog and have now scrolled through the entire thing several times. I am very impressed and inspired by your skill and creativity, and your "style" is very much in line with mine. I hope you keep blogging and sharing your design idea
ReplyDeleteweb designing training in chennai
web designing training in velachery
digital marketing training in chennai
digital marketing training in velachery
rpa training in chennai
rpa training in velachery
tally training in chennai
tally training in velachery
web designing training in chennai
web designing training in velachery
digital marketing training in chennai
digital marketing training in velachery
rpa training in chennai
rpa training in velachery
tally training in chennai
tally training in velachery
instagram takipçi satın al
ReplyDeleteinstagram takipçi satın al
instagram takipçi satın al
instagram takipçi satın al
instagram takipçi satın al
instagram takipçi satın al
instagram takipçi satın al
Tül Perde Modelleri
ReplyDeletesms onay
mobil odeme bozdurma
NFT NASİL ALINIR
ankara evden eve nakliyat
trafik sigortasi
Dedektor
web sitesi kurma
ASK ROMANLARİ
smm panel
ReplyDeleteSmm panel
isilanlariblog.com
İnstagram takipçi satın al
hirdavatci
Https://www.beyazesyateknikservisi.com.tr
SERVİS
tiktok jeton hilesi