[SOLVED] How would someone make an HTTP server that accepts CSV files/ JSON strings from a 3rd party over a socket?

Specifically I would like Ignition to accept CSV files / JSON strings from a 3rd party piece of hardware talking on the http protocol.

Any examples of this? Any idea on where to start looking?

You’d use the WebDev module. Just make a POST handler.

https://docs.inductiveautomation.com/display/DOC81/WebDev#WebDev-PythonResources

2 Likes

I don’t think the 3rd party hardware is smart enough to point it’s data to Ignition.

I looked at this example of code but I can’t specify a URL.
https://docs.inductiveautomation.com/display/DOC80/httpPost

I am thinking I might have to create a web server that takes the data from a specific port and redirects it to Ignition on the server side.

You’re putting the whole URL in the host field. Put the URL part in the field in the lower right.

1 Like

You were right sir but I also had to fix my firewall. I made a POST handler here:

	# get the incoming parameters
	#{"PE":128,"UID":"WISE-4220-S250_74","MAC":"74-00-08-5C-10-9F","TIM":"164376592","Record":[[0, 1, 1,  0],[0, 0, 4,  0],[0, 1, 4,  0]]}
	data = request['postData']
	PE = data['PE']
	UID = data['UID']
	MAC = data['MAC']
	TIM = data['TIM']
	Record = data['Record']
	
	# this will print to the wrapper.log file
	print PE, UID, MAC, TIM, Record
	
	for x in Record:
		ds = system.tag.read('[default]ds').value
		newRow = x
		ds = system.dataset.addRow(ds, newRow)
		system.tag.write('[default]ds', ds)
	 
	return {'html': 1}