I think I figured it out, for updating a existing policy
1) guid is required
2) id is required
3) version is required ( the value should be the latest version number, you can retrieve the version via API GET )
4) <l7:Resource type="policy"> contains a one-line string which needs to be encoded from xml to ASCII
Working example
<l7:Policy guid="b8d40c59-c97f-455a-806a-**********" id="24e6fd7c5b6fb3**********" version="{{ tmpxmlhash.version.0 }}" xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
<l7:PolicyDetail folderId="bc9a31b7578652a08a514d7d4fef25f3" guid="b8d40c59-c97f-455a-806a-***********" id="24e6fd7c5b6fb3a9669024********" version="{{ tmpxmlhash.version.0 }}" xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
<l7:Name>#OTK id_token configuration</l7:Name>
<l7:PolicyType>Include</l7:PolicyType>
<l7:Properties>
<l7:Property key="revision">
<l7:LongValue>2</l7:LongValue>
</l7:Property>
<l7:Property key="soap">
<l7:BooleanValue>false</l7:BooleanValue>
</l7:Property>
</l7:Properties>
</l7:PolicyDetail>
<l7:Resources>
<l7:ResourceSet tag="policy">
<l7:Resource type="policy">
<?xml version="1.0" encoding="UTF-8"?> <wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy"> <wsp:All wsp:Usage="Required"> <L7p:CommentAssertion> <L7p:Comment stringValue="Target Configuration Policy: &quot;OTK id_token configuration&quot;"/> </L7p:CommentAssertion> <L7p:CommentAssertion> <L7p:Comment stringValue="=== Set custom values for Context Variables below ==="/> </L7p:CommentAssertion> <L7p:CommentAssertion> <L7p:Comment stringValue="=== Add any new Context Variables or extensions below ==="/> </L7p:CommentAssertion> <L7p:SetVariable> <L7p:AssertionComment assertionComment="included"> <L7p:Properties mapValue="included"> <L7p:entry> <L7p:key stringValue="LEFT.COMMENT"/> <L7p:value stringValue="=="/> </L7p:entry> <L7p:entry> <L7p:key stringValue="RIGHT.COMMENT"/> <L7p:value stringValue="// Issuer Identifier (including protocol and port)"/> </L7p:entry> </L7p:Properties> </L7p:AssertionComment> <L7p:Base64Expression stringValue="{{ url_dmz_gateway }}"/> <L7p:VariableToSet stringValue="iss"/> </L7p:SetVariable> </wsp:All> </wsp:Policy>
</l7:Resource>
</l7:ResourceSet>
</l7:Resources>
</l7:Policy>
About the LongValue, I am not sure why we need it, the value could be an integer and no need to be updated it , e.g. could always be set to 2.
Regards,
Naichun