Down a rabbit hole with http and Milestone

So, I have perused a many of topics about using httpClient and post/get but something is just not clicking for me yet. I am trying to integrate ignition with a trial version of Milestone x protects API gateway to dynamically create bookmarks. The POST method for bookmarking can be found here: MIP VMS RESTful Bookmarks API reference. However, before I get to that point, I have been going through the ‘getting started’ docs here: MIP VMS RESTful Config API reference. I know my installation is valid because I was able to perform step 6 via a system.net.httpget() and it returns the expected response. I get lost on the formatting for step 7 though. I guess what I’m asking is can someone help me ‘translate‘ the header/data from the link in to either system.net.httpPost() or even using the httpclient() and client.post() which I know is the preferred method.

According to Milestone, it's XProtect VMS API Gateway. (Note spelling, spacing and capitalisation. It matters to identify brand names in text and for search results.)

I was able to get the api token with the following code(actual URL and creds omitted obviously). Now on to the bookmarking. I might run into the issue that Nick had in this post Problems with Talk2M DMWeb API through system.net.httpClient and system.net.httpPost - Ignition - Inductive Automation Forum, but we’ll see shortly!

import urllib
url = "http://somebogusurl.com/API/IDP/connect/token"
payload = urllib.urlencode({
    "grant_type": "password",
    "username": "User",
    "password": "password",
    "client_id": "GrantValidatorClient"
})

try:
    # Create an HttpClient instance (or use system.net.httpClient directly in Ignition 8.3+)
    # For older versions, consider creating a top-level instance for reuse.
	httpClient = system.net.httpClient() 
    
    #response = httpClient.post(url, data=payload) # Use data for form-urlencoded
    # Or for JSON payload:
	response=httpClient.post(url=url, headers={"Content-Type":"application/x-www-form-urlencoded"}, data=payload) 
	print response.json

except Exception as e:
	print(e)