Make a Post request with Authorization to drive a Cam

whats the model number of your cam, ill have a quick dig and see what i can find

Thanks a lot Hootie81 for your help on this topic!

We found almost nothing about the cam, D-Link does not want that we control it outside D-link interface.
My Cam is a DCS-933L
I’ve found the command on this web site:
It work well with POSTMAN, but with the Spark Core…

Are you using a proxy?
Is the address of the proxy or that of the webcam?

Sorry timix I was at work until now…
I think that the IP is the address of the Camera (which is connected to my rooter in Wifi)
I have try to access with different computers to change the parameters of the cam, and it work so I concluded that there is no proxy.
I’m not an expert in software, I come from Hardware…

No other idea where the issue can come from? Any Expert here?

OK. I was trying to work out how you were intercepting the http request and viewing it, but I can see you’ve used RequestBin.

Can you try removing the ‘\r\n’ from the line: sprintf(line, “ReplySuccessPage=motion.htm&ReplyErrorPage=motion.htm&MotionDetectionEnable=1&MotionDetectionScheduleDay=0&MotionDetectionScheduleMode=0&MotionDetectionSensitivity=90&ConfigSystemMotion=Save\r\n”); You might want to put it back in again if it still doesn’t work, or try both ways with my next suggestion.

I would also try putting in the extra headers such as User-Agent, simply to remove any doubt. I was trying to do something similar a couple of months ago and found that my web server wouldn’t work without one of the headers which I’d deliberately not bothered with because I thought it was unnecessary - but in my case it wouldn’t work without it.


Same reply (400 Bad Request) without the ‘\r\n’

So I try with a 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.91 Safari/537.36’
with and without ‘\r\n’ this is also the same reply (400 Bad Request)

I will try again adding ‘Origin’…

Could you make your camera temporarily available from the interwebs (ie port forward to the camera IP) and test the POST requirements with a service like hurl it and see what the difference is. I know you use postman but i would like to see how different services repond and where the difference is.

you could also try pointing the request to posttestserver and seeing the post request, similar to request bin, but a tad simpler. you will have to watch the serial monitor to get the link to the results from the core…

1 Like

The aim of my control is to be internal in my network and the spark core make the exchange with internet (for activation)
I will try to point request to posttestserver when I find some time, but I’m a little bit disappointed do not find a solution…