406 error when making POST request in API?

So I’m trying to write a snippet of code that basically returns search results when prompted with a certain IP address, and I’m trying to do this using /api/3/assets/search endpoint. However, I keep on getting a 406 error which implies there something wrong with my “Accept” header. Which makes no sense because I’m using “/” as my Accept header which should in theory accept any content type. This is my full snippet of code I’m using

import requests
import json

base_url = "https://<instance>:3780"

cookies_file_path = "rapid_cookies.txt"

with open(cookies_file_path, 'r') as file:
    cookies = file.read().strip()

ip_address = '10.XX.X.X'    #Sample IP address here

headers = {
    "Cookie": cookies,
    'Content-Type': 'application/json',
    'Accept': '*/*'  
}

# The search criteria
search_criteria = {
    "match": "all",
    "filters": [
        {
            "field": "ip-address",
            "operator": "is",
            "value": ip_address
        }
    ]
}

url = f"{base_url}/api/3/assets/search"

# Make the API request
response = requests.post(url, headers=headers, json=search_criteria)

If I were to print out the response.json, it’d say something pertaining to a 406 error. I tried testing it on Postman and I’m getting the same issue. If anyone can lend a helping hand, I’d appreciate it greatly.

Try deleting your “Cookie” header, and not sending nexposeCCSessionID at all. Only send the “Authorization: Basic …” header for authentication