I have been playing around with the API for a while now, but whatever I do, i cannot solve the following situation:
I have a python script connecting to the qb web api using the "requests" module. /login and therefore obtaining an authentication cookie work fine, following commands like /query/preferences work just as fine.
But whenever I try to set qb preferences using /command/setPreferences I get a 400 Bad Request response.
This is the raw data directly from fiddler:
Code: Select all
POST http://localhost:1234/command/setPreferences HTTP/1.1
Host: localhost:1234
Content-Length: 21
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.9.1
Connection: keep-alive
Cookie: SID=iWMAADoeAACZaAAAVgkAAAIaAAAFeAAA
Content-Type: application/x-www-form-urlencoded
{"listen_port": 4728}
Code: Select all
HTTP/1.1 400 Bad Request
Code: Select all
jsonData={"listen_port":4728}
headerData = {
'Cookie' : cookie,
'Content-Type' : 'application/x-www-form-urlencoded'
}
response = requests.post(server + ":" + port + "/command/setPreferences", json=jsonData, headers=headerData)
What is it that I am doing wrong though? Thank you very much in advance,
-b