This project is running in NodeJS, I have successfully been able to change the camera's mode while using postman, however when I try to make the same POST request in NodeJS the new mode doesn't set. I am using "request" to simplify the request. Documentation on that is here: https://github.com/request/request#forms
Here's some code:
Code: Select all
request.post({
url: `${zmRoot}/monitors/${camera}.json`,
form: {
Monitor: {
Function: mode, //This holds a string value of either "Modect" or "Mocord."
}
}
}, (err, httpResponse, body) => {
if (err) {
reject(err);
} else {
resolve(JSON.parse(body));
}
});
Code: Select all
{ message: 'Saved' }