How to generate JSON payload

Community Alums
Not applicable

Hi, can someone assist me to script this kind of payload (yellow highlighted)

 

 <name>The name of the downtime</name>
    <action name="ENFORCE_ON_REPORTS">
    </action>
    <approver>The approver name</approver>
    <category>1</category>
    <notification>
        <recipients>
            <recipient id="24"/>
            <recipient id="22"/>
            <recipient id="21"/>
        </recipients>
    </notification>

6 REPLIES 6

Community Alums
Not applicable

i know how to define  

<approver>The approver name</approver>
 <category>1</category>

 

the link you mentioned doesnt explain how to define this 

  <action name="ENFORCE_ON_REPORTS">

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Is this for some integration where you need to send the xml as request?

if yes then you can construct the xml string and then post it

please give some details around this

Regards
Anukr

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Community Alums
Not applicable

here the xml i plan to construct.

 

<downtime userId="1" planned="true" id="8898e5a5dbcdc953e04037104bf5737c">
    <name>The name of the downtime</name>
    <action name="ENFORCE_ON_REPORTS">
    </action>
    <approver>The approver name</approver>
    <category>1</category>
    <notification>
        <recipients>
            <recipient id="24"/>
            <recipient id="22"/>
            <recipient id="21"/>
        </recipients>
    </notification>
    <selectedCIs>
        <ci>
            <id>ac700345b47064ed4fbb476f21f95a76</id>
            <viewName>End User Monitors</viewName>
        </ci>
    </selectedCIs>
    <schedule xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="WeeklyScheduleType">
        <type>WEEKLY</type>
        <startDate>2010-06-10T15:40:00</startDate>
        <timeZone>Europe/Zurich</timeZone>
        <days>
            <selectedDays>WEDNESDAY</selectedDays>
            <selectedDays>THURSDAY</selectedDays>
            <selectedDays>FRIDAY</selectedDays>
            <selectedDays>SATURDAY</selectedDays>
        </days>
        <startTimeInSecs>52800</startTimeInSecs>
        <durationInSecs>300</durationInSecs>
    </schedule>
</downtime>