You're viewing Apigee Edge documentation.
Go to the
Apigee X documentation. info
EitherOptionOrFormat
Error message
Deployment of the API proxy through either the Edge UI or Edge management API fails with this error message:
Error Saving Revision [revision_number] XMLToJSON[{0}]: Either Options or Format must be specified.
Example error
Error Saving Revision 1
XMLToJSON[{0}]: Either Options or Format must be specified.
Example screenshot
Cause
If one of the elements <Options>
or <Format>
is not declared in the XML to JSON Policy, then the deployment of the API proxy fails.
<Options>
is required if <Format>
isn't used.
Use either the <Format>
element or <Options>
element group. You cannot use both <Format>
and <Options>
. Predefined formats include: xml.com
, yahoo
, google
, and badgerFish
.
Diagnosis
Examine all the XML to JSON policies in the specific API proxy where the failure has occurred. If there is any XML to JSON policy in which either of the elements
<Options>
or<Format>
is not declared, then that's the cause of the error.For example, the following policy does not have either of the elements declared:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <XMLToJSON async="false" continueOnError="false" enabled="true" name="XMLToJSON"> <DisplayName>XMLToJSON</DisplayName> <Properties/> <OutputVariable>response</OutputVariable> <Source>response</Source> </XMLToJSON>
Resolution
Ensure that the XML of the XML to JSON policy has one of the elements <Options>
or <Format>
declared in the policy.
Example 1:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLToJSON async="false" continueOnError="false" enabled="true" name="XMLToJSON">
<DisplayName>XMLToJSON</DisplayName>
<Properties/>
<Format>google</Format>
<OutputVariable>response</OutputVariable>
<Source>response</Source>
</XMLToJSON>
Example 2:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLToJSON async="false" continueOnError="false" enabled="true" name="XMLToJSON">
<DisplayName>XMLToJSON</DisplayName>
<Properties/>
<Options>
<RecognizeNumber>true</RecognizeNumber>
<RecognizeBoolean>true</RecognizeBoolean>
<RecognizeNull>true</RecognizeNull>
</Options>
<OutputVariable>response</OutputVariable>
<Source>response</Source>
</XMLToJSON>
UnknownFormat
Error message
Deployment of the API proxy through either the Edge UI or Edge management API fails with this error message:
Error Saving Revision [revision_number] XMLToJSON[policy_name]: Unknown Format [unknown_format].
Example error
Error Saving Revision 1
XMLToJSON[WithFormat]: Unknown Format google.com.
Example screenshot
Cause
If the <Format>
element within the XML to JSON policy has an unknown format defined, then the deployment of the API proxy fails.
Predefined formats include: xml.com
, yahoo
, google
, and badgerFish
.
Diagnosis
Identify the XML to JSON policy where the error occurred and the unknown format. You can find this information from the error message. For example, in the following error, the policy name is
WithFormat
and the unknown format isgoogle.com
:Error Saving Revision 1 XMLToJSON[WithFormat]: Unknown Format google.com.
Verify that the unknown format specified in the failed XML to JSON policy matches with the value identified in the error message (step #1 above). For example, the following policy specifies the format as
google.com
, which matches what's in the error message:<XMLToJSON async="false" continueOnError="false" enabled="true" name="WithFormat"> <DisplayName>WithFormat</DisplayName> <Properties/> <Format>google.com</Format> <OutputVariable>response</OutputVariable> <Source>response</Source> </XMLToJSON>
If the Format specified is not one among the predefined formats
xml.com
,yahoo
,google
, orbadgerFish
, then that's the cause of the error.In the example XML to JSON Policy shown above, the format is
google.com
which is invalid. Therefore, the deployment of the API Proxy fails with the error:XMLToJSON[WithFormat]: Unknown Format google.com.
Resolution
Ensure that the format specified in the <Format>
element of the XML to JSON policy
is valid. For example:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<XMLToJSON async="false" continueOnError="false" enabled="true" name="WithFormat">
<DisplayName>WithFormat</DisplayName>
<Properties/>
<Format>google</Format>
<OutputVariable>response</OutputVariable>
<Source>response</Source>
</XMLToJSON>