Restman Failure in Migrating Policy
search cancel

Restman Failure in Migrating Policy

book

Article ID: 225315

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

While attempting to migrate a policy (the backing policy) using Restman, the following failure occurs:

Resource validation failed due to 'INVALID_VALUES' Unable to update policy: Entity <Policy_guid>: version mismatch

 

Environment

API Gateway 10.0

Cause

It is recommended to use the BUNDLE option when migrating a policy or policy changes from one environment to another using the Restman API 

Docs for Restman bundle:

https://<GATEWAY_HOST>:9443/restman/1.0/doc/restDoc.html#1.0/bundle

 

 

 

 

 

Resolution

1. RESTAPI: Create a bundle

NOTE: If the policy exists in both ends use query parameter &defaultAction=NewOrUpdate when creating the BUNDLE

Example:

https://<GATEWAY_HOST>:9443/restman/1.0/bundle?policy=<policy_GUID>&defaultAction=NewOrUpdate

Results of REST API GET Bundle - the green needs to be modified/removed before the PUT action

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<l7:Item xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
    <l7:Name>Bundle</l7:Name>
    <l7:Type>BUNDLE</l7:Type>
    <l7:TimeStamp>2021-09-24T12:30:30.303-04:00</l7:TimeStamp>
    <l7:Link rel="self" uri="https://<GATEWAY_HOST>:9443/restman/1.0/bundle?policy=<policy_GUID>&amp;defaultAction=NewOrUpdate"/>
    <l7:Resource>
        <l7:Bundle>
            <l7:References>
                <l7:Item>

.

            </l7:Mappings>
        </l7:Bundle>
    </l7:Resource>
</l7:Item>


2. Modify the bundle to be imported 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<l7:Bundle xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
            <l7:References>
.

            </l7:Mappings>
        </l7:Bundle>

3. Use the PUT option to import the modified bundle

https://<GATEWAY_HOST>:9443/restman/1.0/bundle