Replication REST API

cancel
Showing results for 
Search instead for 
Did you mean: 

Replication REST API

resplin
Intermediate
0 0 1,897

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



ReplicationCheetah


Payload Definitions


JSON will be used for payloads throughout the API.




Requests


ReplicationDefinitionRequest


Typically used when creating and editing Replication Definitions



{
    'name': string, // Only needed if renaming
    'description': string,
    'payload': [ // NodeRefs
         string, string, string
    ],
    'enabled': boolean,
    'targetName': string,
    'schedule':       // Null, if schedule is not specified
    {
       'start': iso8601date,
       'intervalPeriod': string,       // Month, Week, Day, Hour, Minute, Second
       'intervalCount': number
    }
    // TODO - Flags
}

This is a cutdown version of DetailedReplicationDefinitionResponse, covering only the editable fields.


Responses


SimpleReplicationDefinitionResponse


Used to return details on a number of replication definitions



{
    'name': string,
    'status': string (New|Running|CancelRequested|Completed|Failed|Cancelled|Pending),
    'startedAt':
    {
        'iso8601': iso8601date
    },
    'enabled': boolean,
    'details': url
}

The details URL is to a GET webscript that will return a DetailedReplicationDefinitionResponse


DetailedReplicationDefinitionResponse


Used to return the detail of one replication definition



{
    'name': string,
    'description': string,
    'status': string (New|Pending|Running|CancelRequested|Completed|Failed|Cancelled|Pending),
    'startedAt':
    {
        'iso8601': iso8601date
    },
    'endedAt':
    {
        'iso8601': iso8601date
    },
    'failureMessage': string, // Null if status isn't Failed
    'executionDetails': url, // Only if status is Running or CancelRequested
    'payload': [
       {
           'nodeRef': string,
           'isFolder': boolean,
           'path': string
       },
       {
           'nodeRef': string,
           'isFolder': boolean,
           'path': string
       }
    ],
    'transferLocalReport': string, // NodeRef
    'transferRemoteReport': string, // NodeRef
    'enabled': boolean,
    'targetName': string,
    'schedule':       // Null, if schedule is not specified
    {
       'start': iso8601date,
       'intervalPeriod': string,       // Month, Week, Day, Hour, Minute, Second
       'intervalCount': number
    }
    // TODO - Flags
}

If schedule start is given, it is the date from which the action will be scheduled to run. If a date is given, it is treated as midnight. The interval is a count plus period (one of Month, Week, Day, Hour, Minute, Second). If an interval is given but no start time, midnight today is used.

Note - A moderate amount of detail of the Transfer Target is included here, because there isn't a dedicated API for listing and editing Transfer Targets.


RunningActionResponse


Used to return the detail of one running action, be it replication or otherwise



{
    'actionID': string,
    'actionType': string,
    'actionInstance': string,
    'actionNodeRef': string,
    'startedAt':
    {
       'iso8601': iso8601date // Null if in the pending queue
    },
    'cancelRequested': boolean,
    'details': url
}




Resources


Replication Definition Collection


Get Replication Definition Collection


Retrieves all the currently defined, persisted Replication Definitions. The entries in the response can be sorted by Name, Status and Last Run Time. The default sort is by name



GET /api/replication-definitions
    


GET /api/replication-definitions?sort=status
    

Example response data:



{
    'data': [
        {
            'name': 'ReplicationTask1',
            'status': 'New',
            'startedAt': null,
            'enabled': false,
            'details': '/api/replication-definition/ReplicationTask1',
        },
        {
            'name': 'ReplicationTask2',
            'status': 'Running',
            'startedAt':
            {
                'iso8601': '2010-07-01T12:33:41Z'
            },
            'enabled': true,
            'details': '/api/replication-definition/ReplicationTask2'
        }
    ]
}

See SimpleReplicationDefinitionResponse for payload definition.


Post Replication Definition Collection


Creates a new  Replication Definition.



POST /api/replication-definitions
     => ReplicationDefinitionRequest
    

Example request data:



{
    'name': 'Replication Task 2',
    'description': 'Replicates to the 2nd server',
    'payload': [
        'workspace://SpacesStore/19c3c4e6-86f1-4640-ae48-673a39a3ce82',
        'workspace://SpacesStore/49c3c4e6-86f1-4640-ae48-673a31a0ce87'
    ],
    'enabled': true,
    'targetName': 'Target2',
    'schedule':
    {
       'start':
       {
          'iso8601': '2010-07-01T12:33:41Z'
       },
       'intervalPeriod': Hour,
       'intervalCount': 2
    }
}

Example response data:



{
    'data':
    {
        'name': 'Replication Task 2',
        'description': 'Replicates to the 2nd server',
        'status': 'New'
        'startedAt': null,
        'endedAt': null,
        'failureMessage': null,
        'executionDetails': null,
        'payload': [
            {
                'nodeRef': 'workspace://SpacesStore/19c3c4e6-86f1-4640-ae48-673a39a3ce82',
                'isFolder': false,
                'path': '/images/logo.jpg'
            },
            {
                'nodeRef': 'workspace://SpacesStore/49c3c4e6-86f1-4640-ae48-673a31a0ce87'
                'isFolder': true,
                'path': '/images/americas/'
            }
        ],
        'transferLocalReport': null,
        'transferRemoteReport': null,
        'enabled': true,
        'targetName': 'Target2',
        'schedule':
        {
           'start':
           {
              'iso8601': '2010-07-01T12:33:41Z'
           },
           'intervalPeriod': Hour,
           'intervalCount': 2
        }
    }
}

See ReplicationDefinitionRequest and DetailedReplicationDefinitionResponse for payload definition.


Replication Definition


Get Replication Definition


Retrieves the details on a currently defined, persisted Replication Definition.



GET /api/replication-definition/{replication_definition_name}
    

Example response data:



{
    'data':
    {
        'name': 'Replication Task 2',
        'description': 'Replicates to the 2nd server',
        'status': 'Running'
        'startedAt':
        {
            'iso8601': '2010-07-01T12:33:41Z'
        },
        'endedAt': null,
        'failureMessage': null,
        'executionDetails': '/api/running-action/replicationActionExecutor-1421-22/',
        'payload': [
            {
                'nodeRef': 'workspace://SpacesStore/19c3c4e6-86f1-4640-ae48-673a39a3ce82',
                'isFolder': false,
                'path': '/images/logo.jpg'
            },
            {
                'nodeRef': 'workspace://SpacesStore/49c3c4e6-86f1-4640-ae48-673a31a0ce87'
                'isFolder': true,
                'path': '/images/americas/'
            }
        ],
        'transferLocalReport': null,
        'transferRemoteReport': null,
        'enabled': true,
        'targetName': 'Target2',
        'schedule':
        {
          'start':
          {
             'iso8601': '2010-07-01T12:33:41Z'
          },
          'intervalPeriod': Hour,
          'intervalCount': 2
       }
    }
}

See DetailedReplicationDefinitionResponse for payload definition.


Put Replication Definition


Updates a previously persisted Replication Definition.



PUT /api/replication-definition/{replication_definition_name}
     => ReplicationDefinitionRequest
    

Example request data:



{
    'name': 'Alternate Replication 2', // Only required if renaming
    'description': 'Replicates to the 2nd server',
    'payload': [
        'workspace://SpacesStore/19c3c4e6-86f1-4640-ae48-673a39a3ce82',
        'workspace://SpacesStore/49c3c4e6-86f1-4640-ae48-673a31a0ce87'
    ],
    'enabled': true,
    'targetName': 'Target2',
    'schedule': null        // Clear schedule
}

Note - To rename an existing Replication Definition, PUT to the old name, including the new name.

See ReplicationDefinitionRequest and DetailedReplicationDefinitionResponse for payload definition.


Delete Replication Definition


Deletes a previously persisted Replication Definition.



DELETE /api/replication-definition/{replication_definition_name}
    




Running Actions Collection


Get Running Actions


List currently running actions. This can be all running actions, all running actions of one type, or all running instances of a given action.



GET /api/running_actions/
    


GET /api/running_actions/?type={actionType}
    


GET /api/running-actions/?nodeRef={actionNodeRef}
    

Example response data:



{
    'data': [
        {
            'actionID': '1542',
            'actionType': 'replicationActionExecutor',
            'actionInstance': '32',
            'actionNodeRef': 'workspace://SpacesStore/19c3c4e6-86f1-4640-ae48-673a39a3ce87',
            'startedAt': null,
            'cancelRequested': false,
            'details': '/api/running-action/replicationActionExecutor-1542-32/',
        },
        {
            'actionID': '1542',
            'actionType': 'replicationActionExecutor',
            'actionInstance': '124',
            'actionNodeRef': 'workspace://SpacesStore/19c3c4e6-86f1-4640-ae48-673a39a3ce87',
            'startedAt':
            {
                'iso8601': '2010-07-01T12:33:41Z'
            },
            'cancelRequested': true,
            'details': '/api/running-action/replicationActionExecutor-1542-124/'
        }
    ]
}

See RunningActionResponse for payload definition.


Post (Run) Running Actions


Triggers the execution of a previously persisted action, no matter what type it is. Send the nodeRef of the persisted action to be started. Because the action is scheduled for asynchronous execution, the execution will be placed in the pending queue, and may take some time to begin real execution.



POST /api/running-actions/
     => nodeRef={nodeRef}
    

See RunningActionResponse for payload definition.




Running Replication Actions Collection


Get Running Replication Actions


Gets a list of all currently running replication actions.



GET /api/running-replicaton-actions/
    

Example response data:



{
    'data': [
        {
            'actionID': '1542',
            'actionType': 'replicationActionExecutor',
            'actionInstance': '32',
            'actionNodeRef': 'workspace://SpacesStore/19c3c4e6-86f1-4640-ae48-673a39a3ce87',
            'startedAt': null,
            'cancelRequested': false,
            'details': '/api/running-action/replicationActionExecutor-1542-32/',
        },
        {
            'actionID': '1542',
            'actionType': 'replicationActionExecutor',
            'actionInstance': '124',
            'actionNodeRef': 'workspace://SpacesStore/19c3c4e6-86f1-4640-ae48-673a39a3ce87',
            'startedAt':
            {
                'iso8601': '2010-07-01T12:33:41Z'
            },
            'cancelRequested': true,
            'details': '/api/running-action/replicationActionExecutor-1542-142/'
        }
    ]
}

See RunningActionResponse for payload definition.


Post (Run) Running Replication Actions


Triggers the execution of a previously defined replication definition. Send the name of the replication definition to start. The replication will take place asynchronously, so depending on the number of other actions currently on the queue, it may take some time to start.



POST /api/running-replicaton-actions/
     => name={name}
    

See RunningActionResponse for payload definition.




Running Action Definition


Get Running Action


Retrieves the basic information on a currently running Replication Action.



GET /api/running-action/{action_tracking_id}
    

Example response data:



{
    'data':
    {
        'actionID': '1542',
        'actionType': 'replicationActionExecutor',
        'actionInstance': '32',
        'actionNodeRef': 'workspace://SpacesStore/19c3c4e6-86f1-4640-ae48-673a39a3ce87',
        'startedAt':
        {
            'iso8601': '2010-07-01T12:32:12Z'
        },
        'cancelRequested': false,
        'details': '/api/running-action/replicationActionExecutor-1542-32/' // The current URL
    }
}

See RunningReplicationActionResponse for payload definition.


Delete (Cancel) Running Action


Requests the cancellation of a currently running Replication Action.



DELETE /api/running-action/{action_tracking_id}
    

Note: The cancellation will not occur instantly.