HTTP/1.1 Post to D-Link Camera - http

I am trying to use an HTTP POST command directly to a D-Link DCS-932L camera (I have one camera on F/W 1.12 and another on 1.14, if that helps). I keep getting the 404 File Not Found error.
Running Fiddler, I've turned on motion in the browser and seen the following request:
POST /setSystemMotion HTTP/1.1
Syntax is
ReplySuccessPage=motion.htm&ReplyErrorPage=motion.htm&MotionDetectionEnable=1&MotionDetectionScheduleDay=0&MotionDetectionScheduleMode=0&MotionDetectionSensitivity=45&ConfigSystemMotion=Save
If I try to turn on motion using an HTTP POST command via the Chrome Extension Postman using the exact same request and syntax I get
<html><body><h2>Error: File Not Found</h2>
<p>getfile: Cannot open URL(/etc_ro/web/setform/setSystemMotion,No such file or directory)</p></body></html>
It seems that the camera's server has decided to route my ./setSystemMotion to this ./etc_ro/web/setform folder. I'm happy to provide more details, but can anybody shed some light on what might cause that change?
Thanks!

I've the same issue.
resolved with this curl command taken from the below forum
curl "http://<IP>/setSystemMotion" -H "Host: <IP>" \
-H "Referer: http://<IP>/setSystemMotion" -H "Authorization: Basic <AuthCode>" \
-H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" \
--data "ReplySuccessPage=motion.htm&ReplyErrorPage=motion.htm&MotionDetectionEnable=1&MotionDetectionScheduleDay=127&MotionDetectionScheduleMode=1&MotionDetectionScheduleTimeStart=07"%"3A10"%"3A00&MotionDetectionScheduleTimeStop=18"%"3A50"%"3A00&MotionDetectionSensitivity=70&ConfigSystemMotion=Save"
https://www.developpez.net/forums/d1424172/systemes/hardware/achat-conseils/peripheriques/camera-ip-commandes-url-api-dlink-dcs-932l/#post8858654

Related

How do I manually POST JSON data with only an ssh connection (no cURL or other utility)

I want to manually POST JSON data using just a keyboard and ssh connection (i.e. without cURL). The cURL functionality I'm trying to replicate which works great is equivalent to:
curl -s -w '\n' -X POST -D - \
-H "Content-type: application/json" \
-d '{"param1":"value1","param2":"value2"}' \
https:///myserver.com/mypath
However, when I connect manually:
openssl s_client -connect myserver.com:443 -quiet
and then enter
POST /mypath HTTP/1.1
Host: myserver.com
Content-type: application/json
Accept: application/json
{
"param1": "value1",
"param2": "value2"
}
I get the message "Json content error HV000116: The object to be validated must not be null." I've tried every variation I can think of with whitespace, and encoding, but I still get the error. I know I'm missing something simple, but what is it?
Doh! Just needed to add the Content-length header and everything worked

camel rest servlet 404 instead of 405

Using the sample code from Camel in github in 1 I am getting 404 instead of 405.
This is a summary of the code in 1
rest("/provider").description("Provider rest service").consumes("application/json").produces("application/json").get("/{id}").description("Find provider by id").outType(Provider.class).to("bean:providerService?method=getProvider(${header.id})");
When I send this I am getting the right answer.
curl -X GET -H "Accept: application/json" http://localhost:8080/providerservice/rest/provider/123
When I send this I am getting 404. I am expecting 405
curl -X POST -H "Accept: application/json" http://localhost:8080/providerservice/rest/provider/123
I appreciate any help!!
Not sure if it was you whom logged a JIRA ticket about this: https://issues.apache.org/jira/browse/CAMEL-12050
But this functionality has now been implemented and will be in the upcoming Apache Camel 2.21.0 release onwards.

What is curl doing with -d and -X GET?

I'm looking to this snippet of code:
curl -X GET 'https://api.newrelic.com/v2/applications/1622/metrics/data.json' \
-H 'X-Api-Key:30f4ec24a1f7dd9998a536b05840b17f7d42c7c1' -i \
-d 'names[]=EndUser&names[]=EndUser/Apdex&values[]=call_count&values[]=average_response_time&values[]=score&summarize=true'
from "Listing your app ID and metric data".
But curl's man page only talks about -d/--data in the context of POST requests, so, what's really happening here in terms of the HTTP request sent to the server?
-d with GET request just sends a query string, however the endpoint where data are sent must be set to consume application/x-www-form-urlencoded content type - have just checked that.
In general it's weird and I wouldn't implement it in such a way.
When such query is sent to java servlet - the body is accessible via.. getInputStream() method [sic!].

how to access GSA API

I have a Google Search Appliance and am trying to access the API to download the Event Logs. I am using curl through cygwin on the Windows 7 command line.
I am able to get an authentication token using
curl -X POST -d Email=username -d Passwd=password "http://ip.ad.dr.ess:8443/accounts/ClientLogin"
My problem is that when I attempt to retrieve the even logs themselves:
curl -k -X GET -d query=User -H "Content-type: application/atom+xml" -H "Authorization: GoogleLogin Auth=e73265ce254f7c4afbcbee1743a56e81" "http://10.29.5.5:8000/feeds/logs/eventLog"
curl says that it cannot reach the host:
curl: (7) couldn't connect to host
Any help in getting this to work is greatly appreciated.
Check if you can telnet to the IP-address. If you get a timeout there you should check firewalls etc.
C:\> telnet 10.29.5.5 8000
This looks like a more generic network problem than a problem with either the GSA or Curl.
The problem turned out to be the configuration with my GSA. The GSA is configured to require communication over HTTPS. Because all GSAs default to HTTP traffic over port 8000 and HTTPS traffic over 8443, my problem was solved by sending the following:
curl -k -X GET -d query=User -H "Content-type: application/atom+xml" -H "Authorization: GoogleLogin Auth=e73265ce254f7c4afbcbee1743a56e81" "https://ip.ad.dr.ess:8443/feeds/logs/eventLog"

How do you create a user using RESTServer in Drupal?

Using REST Server 6.x-2.0-beta3, I'm trying to understand how to post to user.save.
curl -d 'XX' -v http://localhost/services/rest/service_user/save
I've tried to replace XX with:
account{'name':'myname','pass':'mypassword','mail':'my#email.org'}
account = {'name':'myname','pass':'mypassword','mail':'my#email.org'}
account="name=myname,pass=mypassword,mail=myemail.org"
account=name=myname,pass=mypassword,mail=myemail.org
account=myname,mypassword,myemail.org
But none of these seems to be right and finding any documention regarding this is next to impossible.
I've also tried the following:
curl -H "Content-Type: application/json" -d 'account={"name":"myname","pass":"mypassword","email":"123"}' -v http://localhost/services/rest/service_user/save
The error I get in this case is:
HTTP/1.0 406 Not Acceptable: Missing required argument account
Hi I also just started working with this module and wondering how to create content using JSON.
Just been able to create a simple node using this:
Post URL: http://path-to-site/services/rest/node
Request Header: Content-Type: application/json
Request Body: {"type":"story","title":"REST Test","body":"REST using JSON"}
I think you're using the wrong URL
I figured it out:
curl -H “application/x-www-form-urlencoded” -d "sessid=xxxx" -d "account[name]=MyName&account[pass]=mypass&account[mail]=myemail#gmail.com&account[conf_mail]=myemail#gmail.com" -v http://path-to-site/services/rest/service_user/save
You only have to add -d "sessid=xxxx" if you have configured Services to require a session. Make sure in that case to replace xxxx with your actual session id (from system.connect).

Resources