pythonpython-3.xapipython-requestsant-media-server-sdk

How to send post request in Python for Ant media API


I am trying to write a python HTTP request code to send the data to Ant media server through one of its API. But I unable to send POST request however I was successful in GET requests.

import requests 
url = "http://localhost:5080/LiveApp/rest/broadcast/create"

body12 = {
    "name": "TESTAPIsss",
    "description":"hiiii",
    "type": "streamSource",
    "streamId":"650320906975923279669775",  
    "streamUrl": "rlink"
}
headers = {'content-type': 'application/json'}

x = requests.post(url, data=body12, headers=headers)

print(x.text)

The error which I am facing is

Unrecognized token 'name': was expecting 'null', 'true', 'false' or NaN at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 6]


Solution

  • This answer is not working anymore.