Skip to main content
Known Participant
Sep 21, 2023 10:00 AM UTC
Question

xml Body parameter for webapi to test

Hi,

I have an webapi which accepts xml as body request, So in order to test that webapi, I'm passing below xml:

<UserInformation>
<id>TestUser1</id>
<isAppianUser>true</isAppianUser>
<firstName>Test</firstName>
<lastName>User1</lastName>
<name>Test User 1</name>
<systemRole>{'Initiator','Manager'}</systemRole>
<market>Hong Kong</market>
</UserInformation>

But I'm getting below error when I test:



can anyone help me how to test webapi in this case.

2 replies

stefanhelzle0001
Brainy
Sep 21, 2023 12:31 PM UTC

Can you share the code of your API implementation?

mathieud0001
Genius
Sep 22, 2023 3:56 AM UTC

Set "application/xml" as your content type?

I used the xmltojson function in the XML parser plugin.

a!fromJson(xmltojson(http!request.body))