Dhcp proxy REST interface json error?

>
> I'm doing some testing on the foreman proxy dhcp REST interface. If I
make a test call using curl I get the following error:
>
> [root@ns1 foreman-proxy]# curl -X POST -d "ip:10.255.92.154" -d
"mac:00:50:56:80:0d:54" -d "hostname=lkotest04" -H "Content-type:
application/json" http://localhost:8443/dhcp/10.255.92.0
> Invalid IP Address
> [root@ns1 foreman-proxy]#
>
> I turned on DEBUG for the log setting and embedded additional debug
statements in server.rb line 92 where the error occurs
> def addRecord options = {}
> logger.debug "LKO - Debugging in server.rb"
> logger.debug options
> logger.debug options[:ip]
> ip = validate_ip options[:ip]
>
> The log shows:
> D, [2013-01-21T22:28:49.212813 #4910] DEBUG – : LKO - Debugging in
server.rb
> D, [2013-01-21T22:28:49.213056 #4910] DEBUG – :
{"network"=>"10.255.92.0"}
> D, [2013-01-21T22:28:49.213147 #4910] DEBUG – : nil
> E, [2013-01-21T22:28:49.213319 #4910] ERROR – : Invalid IP Address
>
> If I invoke the interface without specifying json, I see:
> [root@ns1 foreman-proxy]# curl -X POST -d "ip:10.255.92.154" -d
"mac:00:50:56:80:0d:54" -d "hostname=lkotest04"
http://localhost:8443/dhcp/10.255.92.0
> Invalid IP Address
> [root@ns1 foreman-proxy]#
>
> D, [2013-01-21T22:36:17.711503 #4910] DEBUG – : LKO - Debugging in
server.rb
> D, [2013-01-21T22:36:17.711581 #4910] DEBUG – :
{"ip:10.255.92.154"=>nil, "mac:00:50:56:80:0d:54"=>nil,
"network"=>"10.255.92.0", "hostname"=>"lkotest04"}
> D, [2013-01-21T22:36:17.711672 #4910] DEBUG – : nil
>
> Am I not invoking this properly or is there something wrong?

You are not sending json you need to create a json string representing a
hash.

Ohad
>
> –
> You received this message because you are subscribed to the Google Groups
"Foreman users" group.
> To view this discussion on the web visit
https://groups.google.com/d/msg/foreman-users/-/EmGwMBATEvYJ.
> To post to this group, send email to foreman-users@googlegroups.com.
> To unsubscribe from this group, send email to
foreman-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/foreman-users?hl=en.

··· On Jan 22, 2013 7:16 AM, wrote: