FortiManager
FortiManager supports network operations use cases for centralized management, best practices compliance, and workflow automation to provide better protection against breaches.
bksol92
Staff
Staff
Article Id 403974
Description This article describes how to discard changes saved in a workflow session using FortiManager's API. 
Scope FortiManager v7.4.7, v7.6.3.
Solution

FortiManager allows users to discard changes saved in a workflow session, but not submitted for approval. This can also be done via FortiManager's API.

 

In this instance, a user has saved a change to rename a policy to 'test-policy-01':

 

Screenshot 2025-07-29 094805.png

 

However, the change request has not been submitted for approval (note the icon beside the session name):

 

Screenshot 2025-07-29 093759.png

 

An administrator in the configured approval group could send the following API query to discard saved changes from a session (Python used below):

 

def discard(fmg_session, id):
req = {
"id": 1,
"jsonrpc": "2.0",
"method": "exec",
"params": [
{

"url": "/dvmdb/adom/"+ADOM_NAME+"/workflow/discard/"+str(id)
}
],
"session": fmg_session
}
result = requests.post(URL,json=req,verify=False)

 

The same query can be used on Postman tool as below: 

 

{
"method": "exec",
"params": [
{
"url": "/dvmdb/adom/{adom}/workflow/discard/{session_id}"
}
],
"session": "fmg_session",
"id": 1
}

 

The ID parameter required by the discard query refers to the session ID, which can also be retrieved from the JSON response of the following query:

 

def get_wkfl_sessions(session):
req = {
"method": "get",
"params": [
{
"url": "/dvmdb/adom/" + ADOM_NAME + "/workflow"
}
],
"session": session,
"id": 7
}
resp = requests.post(URL,json=req,verify=False)

 

Getting all workflow sessions from an ADOMGetting all workflow sessions from an ADOM

 

Here, the session ID to be discarded of saved changes is 3. Once the API request is made, the discard action is logged in the ADOM's session list, as can be observed below:

 Screenshot 2025-07-29 100432.png

 

The user who saved the attempt to rename a policy will see their change discarded when the session is resumed:

 

Screenshot 2025-07-29 100704.png