You need to sign in to do that
Don't have an account?
satyaprakash pal
Parsing xml to REST API APEX class
Hello everyon
I have created one Rest api for creating Contacts. How I can test my rest api by passing xml . is ther any way that I test my rest api. I tested using json parser in workbench but I am not able to test my rest api apex code by parsing xml.
//apex class
@Httppost
Global static String candidateInformation(List<Candidate> Candidates, String reqSessionId) {
Note: How I can read the xml in Rest api apex class ?
//Parsing xml request
<?xml version="1.0" encoding="UTF-8"?>
-<Candidates>
-<Candidate>
<JobID>string</JobID>
<EmailAddress>string</EmailAddress>
<FirstName>string</FirstName>
<LastName>string</LastName>
<Phone>string or int</Phone>
-<CoverLetter>
-<![CDATA[string]]>
</CoverLetter>
-<ResumeText>
-<![CDATA[string]]>
</ResumeText>
-<Base64Stream>
-<![CDATA[string]]>
</Base64Stream>
</Candidate>
</Candidates>
I have created one Rest api for creating Contacts. How I can test my rest api by passing xml . is ther any way that I test my rest api. I tested using json parser in workbench but I am not able to test my rest api apex code by parsing xml.
//apex class
@Httppost
Global static String candidateInformation(List<Candidate> Candidates, String reqSessionId) {
Note: How I can read the xml in Rest api apex class ?
//Parsing xml request
<?xml version="1.0" encoding="UTF-8"?>
-<Candidates>
-<Candidate>
<JobID>string</JobID>
<EmailAddress>string</EmailAddress>
<FirstName>string</FirstName>
<LastName>string</LastName>
<Phone>string or int</Phone>
-<CoverLetter>
-<![CDATA[string]]>
</CoverLetter>
-<ResumeText>
-<![CDATA[string]]>
</ResumeText>
-<Base64Stream>
-<![CDATA[string]]>
</Base64Stream>
</Candidate>
</Candidates>
Hi satyaprakashpal,
Try this
please Mark it as best Answer if it helps you.
Thanks ,
karthik