Get Revisions Operation



Get all revisions

# Define the get revisions operation, pass the document id
get_revisions_op = GetRevisionsOperation("companies/1-A")

# Execute the operation by passing it to Operations.Send
revisions = store.operations.send(get_revisions_op)

# The revisions info:
all_revisions = revisions.results  # All the revisions
revisions_count = revisions.total_results  # Total number of revisions

Paging results

  • Get and process revisions, one page at a time:

    start = 0
    page_size = 100
    
    while True:
        # Execute the get revisions operation
        # Pass the document id, start & page size to get
        revisions = store.operations.send(GetRevisionsOperation("comapnies/1-A", Company, start, page_size))
    
        # Process the retrieved revisions here
    
        if len(revisions.results) < page_size:
            break  # No more revisions to retrieve
    
        # Increment 'start' by page-size, to get the "next page" in next iteration
        start += page_size
  • The document ID, start & page size can be wrapped in a Parameters object:

    parameters = GetRevisionsOperation.Parameters("companies/1-A", 0, 100)
    
    revisions = store.operations.send(GetRevisionsOperation.from_parameters(parameters))

Syntax

Parameter Type Description
id string Document ID for which to get revisions
start int Revision number to start from
page_size int Number of revisions to get
parameters Parameters An object that wraps id, start, and page_size