API StatusCode 400 : Missing Data

Hey all. I wrote a little Python app that I need to have send data to my Bubble App.

I’m getting the following error when posting from Python to Bubble:

Python Code:

import json
from urllib.request import urlopen
url = ‘https://my.bubbleapps.io/version-test/api/1.1/wf/criticalsystems
req = url
headerInfo = {‘content-type’: ‘application/json’ }
cudtomerId = “1234567890x0987654321”

    print (line, " - ALIVE")
    postdata = {'customer':cudtomerId, 'ipaddress':line, 'alive':"true"}
    print (postdata)
    jLoad = json.dumps(postdata)
    print (jLoad)

    r = requests.post(req, headerInfo, jLoad)
    print (r.text)
    print (r.status_code)

Here’s the Debugged output from the console window of the Python App. - ALIVE
postdata: {‘customer’: ‘1234567890x0987654321’, ‘ipaddress’: ‘’, ‘alive’: ‘true’}
jLoad: {“customer”: “1234567890x0987654321”, “ipaddress”: “”, “alive”: “true”}
{“statusCode”:400,“body”:{“status”:“MISSING_DATA”,“message”:“Missing parameter for workflow criticalsystems: parameter customer”}}
Press any key to continue . . .

The r.status_code is telling me im missing the parameter “customer” but as you can see it’s being send in jLoad…

Here’s the bubble side:

API Work Flow:

I greatly appreciate the help everyone. Thanks a million!!!

1 Like

Ok, i wound up figuring this out. here’s what i changed! Problem solved. Issue was with my code in Python: I changed the following line…

r = requests.post(req, headerInfo, jLoad)


r = requests.post(req, data=(jLoad), headers=headerInfo)

This fixed the problem now i return StatusCode 200


This topic was automatically closed after 70 days. New replies are no longer allowed.