501 error for httpPost

As a learner
I am trying to implement httpPost Example
However after copying pasting and doing some modification also I am getting

501 error.

I am trying to send the Json data by after clicking on button and then in Webdev trying to get data into variable.

That generally means your WebDev script threw an exception. Showing that in the web result would be insecure. Look in your gateway logs.

Or, perhaps, add logging and try: - except: blocks in your WebDev jython.


show us the webdev post code

in web 501 generaly means it doesnt exists ( Test1 is a wrong name/method?), idk if igntions throws this for something else too tho


What's in your Test1 webdev script exactly ?

Did you make sure to set its method to POST ?

1 Like

I have attached Test1 Webdev script

Getting same error here. Did you manage to solve it?

Normally an exception in your code, if I had to guess in the above, the request["postData"] was the issue as I think the correct dict key is request["data"].

This worked for me.

def doPost(request, session):

	data = request["postData"]
	response_data = data[0][0]["val"]
	system.tag.writeBlocking(["[Test_Tag_Provider]Test/Recipe1"], [response_data])
	response_json = system.util.jsonEncode(response_data)
	return {"response": response_json, "contentType": "application/json"}