restman failure in migrating policy

book

Article ID: 225315

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

Attempting to migrate a policy (the backing policy) using restman.

Getting failure 

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

 

Cause

Recommended when migrating a policy or policy changes from one environment to another with Restman API use the BUNDLE option 

Docs for Restman bundle

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

 

 

 

 

 

Environment

Release : 10.0

Component : API GATEWAY

Resolution

Three steps

  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>:9443/restman/1.0/bundle?policy=<policy_GUID>&defaultAction=NewOrUpdate

Results of REST API Get Bundle, The red need to be modified/removed before PUT

<?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>: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>

 

  1. 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>

  1. PUT 

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

Modified bundle in the body of the PUT