AnsweredAssumed Answered

Make API request using Python: issue with headers

Question asked by Erin Horning on Jan 12, 2018
Latest reply on Jan 17, 2018 by Robert Decker

I am trying to make a request to the checkpoint api using the function below, but when I invoke the function, I get the response: {\n  \"code\" : \"generic_err_missing_required_header\",\n  \"message\" : \"Missing header: [X-chkp-sid]\"\n}"

 

The headers are defined though and look right based on the documentation I have seen. What am I doing wrong here?

 

def get_tag_uid(sid):
      url = 'https://<some ip>/web_api/show-objects'

      headers = {
            'X-chkp-sid': sid,
            'Content-Type': 'application/json'
      }

      data = {
            'type': 'tag'
      }

      s = requests.session()

      response = s.post(url,headers,data,verify=False)

      return response.content

Outcomes