i try to login via a python script, after some struggeling with the certificates i get a return code 200.
but when i try to parse the return value it's not a json object (or structure) it's html.
login-request and check response:
response = requests.post(loginURL, json=login_data)
print(f"response status code : {response.status_code}")
if response.status_code == 200:
print(response.text)
try:
json_data = response.json()
for key in json_data:
print(key)
except ValueError as e:
print("some ERROR raised:")
print(e)
and the print of the response ist html:
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<title>FortiSandbox</title>
<base href="/ng/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<style>@charset "UTF-8";body{font-family:Lato,Helvetica,Arial,sans-serif}body{font-weight:var(--nu-theme-dimension-normal-font-weight)}body{background-color:rgb(var(--nu-theme...................
(and much more, but no values, like a sessionid oder similar)
any hints where i went wrong?
thanks a lot!
Solved! Go to Solution.
Nominating a forum post submits a request to create a new Knowledge Article based on the forum post topic. Please ensure your nomination includes a solution within the reply.
According to FNDN documentation the URL seems correct but the password parameter should be changed to passwd
If not joined yet I would strongly suggest you to join the developer network. Two sponsor approvals are needed and your Fortinet local representative can help with that.
What is the API call in this case? Maybe try with an API client like Postman or curl as a start. I don't have experience with python but based on the result it seems like it's parsing the web page source.
sorry, maybe it's a misunderstanding.
i make an request to a URL
loginURL = "https://fortisand-api.our-donain.com/"
the login-data (from the FortiSandbox-4.4.3-JSON-API Reference):
login_data = {
"method": "exec",
"params": [
{
# "url": "/sys/login/user",
"user": username,
"password": password
}
],
"id": 1,
"ver": "2.3"
and then getting the response:
response = requests.post(loginURL, json=login_data)
but the response contains only html.
so how can i get the session-id in this case to make further calls to the fortisandbox?
is there an error on the URL?
any help is appreciated!
thanks in advance!
According to FNDN documentation the URL seems correct but the password parameter should be changed to passwd
If not joined yet I would strongly suggest you to join the developer network. Two sponsor approvals are needed and your Fortinet local representative can help with that.
Select Forum Responses to become Knowledge Articles!
Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.
User | Count |
---|---|
1688 | |
1087 | |
752 | |
446 | |
226 |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2024 Fortinet, Inc. All Rights Reserved.