Search the Community
Showing results for tags 'reqpuest'.
-
Hey guys, I stumbled upon your awesome piece of software about a month ago. Since then I am working my way up to a complete automated build. Right now I would like to understand how the POST request works. I am trying my hardest since two days to be able to update the whitelisted IP-Addresses using nodejs. When I copy the complete json using Postman everything works just fine. But when I try to get the json from the server and just reupload it (for testing purposes) it resets my settings on the server (success code 204). It may be a simple http error that I am unable to see. Here is my nodejs playground so far. const request = require('request'); var obj request('http://localhost:8096/emby/System/Configuration?api_key=5058514e6c2443a9b03cbcbcf308f06f', (err, res, body) => { if (err) { return console.log(err); } var inbetween = JSON.parse(body); obj = inbetween; }); JSON.stringify(obj); var options = { uri: 'http://localhost:8096/emby/System/Configuration?api_key=5058514e6c2443a9b03cbcbcf308f06f', method: 'POST', json : obj }; console.log(obj); request(options, function (error, response, body) { if (!error && response.statusCode == 204) { console.log(body.id) // Print the shortened url. } console.log(response.statusCode); // console.log(body); }); If you need some server logs just say so. Eltonmaster