Hi, All I am trying to put notes on every customer. My login is successful but when I am trying to call put api through another script of python, its says you are not login in. I have attach my login code below. I have attach cookie in put request header but still it shows error. Any idea on this please.
Thanks
def login_to_acumatica():
# API endpoint
url = "http://my-company/AcumaticaSB/entity/Auth/login"
json_data = ({
"name": "ta",
"password": "Db}",
"tenat": "Store",
"branch": "",
"locale": ""
})
try:
# Send POST request with JSON body
response = requests.post(url, json=json_data)
import re
# Check if the request was successful
if response.status_code == 204:
print("Login successful.")
print("Response:")
cookie = response.cookies
return cookie
else:
print("Login failed with status code:", response.status_code)
except Exception as e:
print("An error occurred:", e)
