Closed sp5101 closed 1 year ago
not sure I am following what you are trying to do?
Can you please paste your entire policy code that you have before and after applying the config.json tokenization? So that I can try it out and provide some details if its possible or not or provide another workaround
This is the policy code. The audience value will be different for each env, So I'm trying to update the value using config.json file.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
in policy.xml
config.json: "policies":[ { "name": policy.xml", "tokens": [ { "xpath": "/ConnectorCallout/Input", "value": "audience-xsnhux.app " }]}]
in the above case its replacing entire input value instead of audience value.
Another way I tried: in policy.xml
REPLACED_BY_CONFIG_JSONin config.json "policies":[ { "name": policy.xml", "tokens": [ { "xpath": "/ConnectorCallout/Input", "value": " <![TEST[{"audience" : "audience-xsnhux.app"} ]]>" }]}]
Due to special characters its not updating proper value in policy file.
@sp5101 - I dont see the policy code. Please paste the xml code (before and after)
Note sure why its not reflecting. I have attached the screenshot of the policy file. Please let me know if its doesn't work.
Why are you trying to change this as part of build? The Connector Callout's Input field can use flow variables. You could just populate a KVM with the appropriate audience value and use that in the policy? Check this doc. With this later if that value changes, you dont have to re-deploy the proxy. By changing the KVM value, it automatically reflects without any downtime and deployment.
Also - why are you using <![TEST[{
instead of <![CDATA[{
. Please follow the recommendation in the docs.
If you still cannot use KVM as I recommended above, can you please confirm this for me - In the Input value, you just want to update the entire JSON, correct?
yes, I would like to update the entire json
The issue you were seeing is due to the "
. You just had to escape that in the config.json
{
"name": "CC-Logging-Extension.xml",
"tokens": [
{
"xpath": "/ConnectorCallout/Input",
"value": "<![CDATA[{\"audience\" : \"abcd.app\"}]]>"
}
]
}
I tried the above mentioned way. due to the presence of "<" & ">" in the string content , it has been converted into "<" & ">". When I download the revision bundle from apigee, the policy file has the original < & > characters.
while accessing the api proxy, will "<" & ">" values impact the api? how it works, Could you help me on this?
dont think it will have impact. If you download the proxy and it has the correct tags, then you should be good! Can you please try it out on your proxy and let me know?
hi @ssvaidyanathan, Its not working. with js script updated the value to make it work.
Thank you!!
Hi Team,
When I'm trying to update the value from config.json, its replacing with some extra characters.
here is sample policy.xml, where I want to update the audience value from config.json.
Modified file :
config.json file: "policies":[ { "name": policy.xml", "tokens": [ { "xpath": "/Input", "value": "http://app.testt.com/" } ] } ]
Its replacing the enter input value
http://app.testt.com/So I tried to update it like string eg: "value": <![TEST[ {"audience" : "http://app.testt.com/"}]]>, due special cart <! > it thrown error. I used the escape cart "/" & "//" to fix it but it escape cart replacing with some other values like "< ".
Could you look into and help me with updating the audience value from config.json file.
Thanks!!