Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3672

Seeing JDATA is missing or invalid errors below are two methods I tried using

$
0
0

Method 1:

def get_positions(susertoken, actid):    url = base_url +"PositionBook"    data = {"uid": "TEST18","actid": actid    }    payload = {"jData": json.dumps(data),"jKey": susertoken    }    headers = {'Content-Type': 'application/x-www-form-urlencoded'    }    response = requests.post(url, headers=headers, data=payload)    response_text = response.text    print(response_text)

Method 2:

def get_positions(susertoken, actid):    url = base_url+"PositionBook"    data = {"jData": '{"uid":"TEST18", "actid":"'+ actid +'"}',"jKey": susertoken    }    payload = "jData="+json.dumps(data)    headers = {'Content-Type': 'application/json'    }    response = requests.request("POST", url, headers=headers, data=payload)    response_json = response.json()    print(response_json)

API, I am using is here - https://shoonya.com/api-documentation#positions-booklogin is successful and susertoken and actid are correct.


Viewing all articles
Browse latest Browse all 3672

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>