19.6 Using REST API for Replication Agreements

Use REST APIs provided by Access Manager to manage replication agreements.

This section describes the following topics:

19.6.1 Querying for Replication Agreement Details

Execute a REST request at the Master's endpoint to query the details of the Replication Agreement (including the polling interval) between a Master and a Clone data center.

  1. If the replication agreement identifier is unknown, run the following command to list all the replication agreement identifiers, else skip this step.

    curl -k -u weblogic:password 'https://supplier.example.com:7002/oam/services/rest/_replication/agreements'
     
    Sample output 1:
    {"featureEnabled":"true","identifiers":"201411211137273612","ok":"true"}
    Sample output 2:
    {"featureEnabled":"true","identifiers":["201411211137273612","201411211137273900"],"ok":"true"}
    
  2. Query the details of a Clone data center's replication agreement (including the polling interval) as follows:

    curl -k -u weblogic:password 'https://supplier.example.com:7002/oam/services/rest/_replication/201409231329353668?type=consumer'
    
    Sample output:
    {"enabled":"true","identifier":"201409231329353668","ok":"true",
      "pollInterval":"60","startingSequenceNumber":"110","state":"READY"}
    
  3. Query the details of a Master data center's replication agreement (including the polling interval) as follows:

    curl -u weblogic:password 'https://supplier.example.com:7002/oam/services/rest/_replication/201409231329353668'
    Sample output:
    {"enabled":"true","identifier":"201409231329353668","lastSequenceNumber":"110","ok":"true","pollInterval":"3600","startingSequenceNumber":"110","state":"ACTIVE"}
    

    Note:

    The poll interval of the Master data center's replication agreement does not affect the actual replication.

19.6.2 Modifying an Existing Replication Agreement

Replication Agreement properties (enabled status, poll interval and the like) can be updated by executing a REST request at the Master's endpoint. Either the Master or Clone Replication Agreement will be updated as specified by the value of the replicaType parameter.

The clone will poll for changes, apply them and wait the duration specified as the pollInterval.

PUT http://supplier.example.com/oam/services/rest/
  _replication/201312040602298762 HTTP/1.1
  Content-Type: application/json
  {"enabled":"false","pollInterval":"60","replicaType":"CONSUMER"}

This example will disable the Clone Replication Agreement and change the poll interval to '60' seconds. If a value for replicaType is not defined (or it is defined as SUPPLIER), the Master's Replication Agreement will be updated.

To edit the poll interval using cURL, use the following command. Note that the replicaType value for updating the clone in this case is SUPPLIER or CONSUMER.

curl -u <repluser> -H 'Content-Type: application/json' -X PUT 
 'https://supplier.example.com/oam/services/rest/_replication/201409231329353668' 
 -d '{"pollInterval":"60","replicaType":"CONSUMER"}'

Table 19-3 lists properties that can be modified using cURL and REST.

Table 19-3 Modifying Replication Agreement Properties

Property Modification Command

BatchSize

Number of change records (journals) returned by the master as a result of a getChanges query by clone. Ideally the default batch size of 32 is sufficient as all changes are pulled in multiple batches as part of fetching. However if the setup needs a large batch size, execute the following command:

curl -u <repluser> -H 'Content-Type: application/json' -X PUT 
 'https://master.example.com/oam/services/rest/_replication/<replid>' 
 -d '{"batchSize":"100","replicaType":"SUPPLIER"}'

User Context

In rare instances, the user context for replication poll may need to be modified.

curl -u <repluser> -H 'Content-Type: application/json' -X PUT 
 'https://supplier.example.com:7002/oam/services/rest/_replication/201409231329353668' 
 -d '{"replicaType":"CONSUMER",
"config":{"entry":{"key":"authorization","value":" 
 BASIC cG9sbHVzZXI6c2VjcmV0"}}}'

'cG9sbHVzZXI6c2VjcmV0' is a base 64 encoded value for polluser credentials. Any user credentials can be used here instead of the repluser which is used to execute the command.

19.6.3 Deleting a Replication Agreement

A Replication Agreement can be deleted by executing the REST API at the Master data center's endpoint. Replication Agreements that are currently active and in use cannot be deleted until the Master and Clone have been disabled.

Disable the replication agreement before you remove it from on the Clone and Master data centers.

  1. Disable the replication agreement on the Clone as follows:

    curl -u <repluser> -H 'Content-Type: application/json' -X PUT
      'https://supplier.example.com:7002/oam/services/rest/_replication/201409231
      329353668' -d '{"enabled":"false","replicaType":"CONSUMER"}''
    
  2. Disable the replication agreement on the Master as follows:

    curl -u <repluser> -H 'Content-Type: application/json' -X PUT
      'https://supplier.example.com:7002/oam/services/rest/_replication/201409231
      329353668' -d '{"enabled":"false","replicaType":"SUPPLIER"}''
    
  3. Delete the replication agreement as follows:

    curl -u weblogic:welcome1 -H 'Content-Type: application/json' -X DELETE
      'https://supplier.example.com:7002/oam/services/rest/_replication/201409231
      329353668'