http PUT request

Feel like this is kind of a newb question, but how would I go about making a http PUT request in luup?

There are many topics on this. Did you search the forum?

  • Garrett

Since this is your first post, we have no idea on your level of expertise with respect to HTTP concepts or Lua programming. You’ll get a better answer if you can describe your exact problem and how much of it you already know how to do.

All that I had found searching the forum was how to do a POST or GET, but wasn’t able to do a PUT request with any of those methods. I ended up using os.execute with a curl

os.execute([[curl -X PUT -H "Content-Type:application/json" -H "Accept:application/json" -d "{\"key\":0, \"key2\":0...}"  http://192.168.1.XXX/api/]])

Is there a better way to do this in Lua without relying on sh?

Try a Google search for luasocket