Hi All,
I'm trying to use 'web_service' to publish changes on the management server (81.20). I'm following the format in the 'Management API Reference' (https://sc1.checkpoint.com/documents/latest/APIs/#web/publish~v1.8.1%20)
Receive error with publish function: {'code': 'not_implemented', 'message': 'Publishing other than current session is not implemented'}
My Python code:
def get_sid():
r = requests.post(
url=f"{chkpt['url']}/web_api/login",
headers={"Content-Type" : "application/json"},
json={'api-key' : chkpt['api-key']},
verify=False
)
r.raise_for_status()
return r.json()
def set_session(name, description, comment):
r = requests.post(
url=f"{chkpt['url']}/web_api/set-session",
headers=headers,
json={
"new-name" : name,
"description" : description,
"comments" : comment},
verify=False
)
r.raise_for_status()
return r.json()
def publish(uid):
r = requests.post(
url=f"{chkpt['url']}/web_api/publish",
headers=headers,
json={'uid' : uid},
verify=False
)
r.raise_for_status()
### Full scenario
# Login
headers = {
"Content-Type" : "application/json",
"X-chkp-sid" : get_sid()['sid']
}
# Set name/description/comment for session
new_session = set_session(name, description, comment)
# Add new hosts to some group
create_new_objects()
# Publish changes
publish(new_session['uid'])
# install policy
install_policy(policy_name)