Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
BarbervdH
Participant
Jump to solution

export management by API (SMS)

 

For a project i'm working on, we are looking to export/import the management configuration, this needs to be done programmatically.
The idea is to rebuild the checkpoint in case something happens. Resources will be redeployed, and the management config should also be reapplied.

I have been looking at the export-management (API) command.
It states that it should be able to do this with a SMS environment, but somehow i keep getting the error message 501 stating that this is only possible with a MDS environment.

What i did so far using postman:
https://<mgmt-server>:<port>/web_api/login (to generate a sid)
https://<mgmt-server>:<port>/web_api/export-management

Stated the content-type and x-chkp-sid in the headers field
in the body of the request tried:

{
"file-path" : "/home/<userid>/backup.tgz"
}

or sending a emty body, but it keeps giving me the error state 501

message""This command can work only on domains of type MDS. Cannot execute it in the current domain (current domain type is Domain)."

 

Tested from the CLI to export the management config, and this was successful

 

Resource used:
https://sc1.checkpoint.com/documents/latest/APIs/index.html#web/export-management~v1.8%20

 

 

0 Kudos
1 Solution

Accepted Solutions
Alex-
Advisor
Advisor

The domain needs to be specified in your login call, not the export-management one.

View solution in original post

(1)
5 Replies
_Val_
Admin
Admin

Hi there,

you need to specify the version of the server. Without it the API assumes you are trying to export a domain only. For an SMS it looks like this:

POST {{server}}/export-management
Content-Type: application/json
X-chkp-sid: {{session}}

{
  "version" : "R81.10",
  "file-path" : "/var/log/exported.tgz"
}
Alex-
Advisor
Advisor

You have to be logged into the System Data domain to run this call from an SMS.

Add "domain" : "System Data" to your login query and it will work.

 

 

BarbervdH
Participant

Thx for the suggestion, but i still get the same error message.
The body i now sent is:

{
 
    "file-path" : "/home/nl18348/backup.tgz",
    "version" : "81.10",
    "domain" : "System Data"
}
0 Kudos
Alex-
Advisor
Advisor

The domain needs to be specified in your login call, not the export-management one.

(1)
BarbervdH
Participant

Ah Yes thanks that did the trick.

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events