Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Sam1
Participant

How to get revisions by API or CLI for R80.40

Hi guys,

  How can I get the revision information by API or CLI for R80.40, I want get revision uid as parameter for install-policy CLI to simply rollback the policy installed on the gateway without reverting the database on the manager.

Best Regards,

Sam

0 Kudos
3 Replies
_Val_
Admin
Admin

You can query sessions' UIDs with "show sessions": https://sc1.checkpoint.com/documents/latest/APIs/?#cli/show-sessions~v1.6.1%20


Sam1
Participant

Thank you very much for your reply, Do you mean that revision UID is actually the session UID?

Another question I would appreciate if you could answer, If call revert-to-revision to revert to specific version it will roll back not only the database, but also the policy that last installed, right?

Best Regards,

Sam

0 Kudos
Art_Zalenekas
Employee
Employee

Starting Management API version 1.6.1, you can use API call show logs and filter for date and Operation field for value Publish and get the Session ID from there. After that, use the API call revert-to-revision which was introduced in API version 1.6 to revert to that specific session.

 

# Query logs for operator Publish
# mgmt_cli -r true show logs new-query.type "audit" new-query.time-frame "yesterday" new-query.filter "operation:\"Publish\"" --format json | jq '.logs[] | { "Time": .time, "Publisher": .administrator, "Changes": .fieldschanges, "Session UID": .session_uid }'

# What are those changes for the Session UID
# mgmt_cli -r true show logs new-query.type "audit" new-query.time-frame "yesterday" new-query.filter "4a052f08-b4fa-44af-bd85-c273b7c18425" --format json | jq '.logs[] | {"Time": .time, "Subject":.subject, "Type": .objecttype, "Object": .objectname, "Operation": .operation, "Changes": .fieldschanges, "Description": .calc_desc}'

# Revert database to Session UID
# mgmt_cli -r true revert-to-revision to-session "29c3c03e-ae9d-4878-a02c-d16075219bf5" --format json

 

This will revert the database to the revision.

Kind regards,
Arturas Zalenekas