You get 401 Unauthorized because you are not authenticated.
according to this salt.netapi.rest_cherrypy page, you must first request a login URL and get an access token, and then you can access other functions through this token.
I will explain more if you need to.
EDIT: explain more:
Example request via curl:
curl -si localhost:8000/login \ -c ~/cookies.txt \ -H "Accept: application/json" \ -H "Content-type: application/json" \ -d '{ "username": "saltuser", "password": "saltuser", "eauth": "auto" }'
and through this curl command you send this request
POST / HTTP/1.1 Host: localhost:8000 Content-Length: 42 Content-Type: application/json Accept: application/json {"username": "saltuser", "password": "saltuser", "eauth": "auto"}
and in return you will receive
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 206 X-Auth-Token: 6d1b722e Set-Cookie: session_id=6d1b722e; expires=Sat, 17 Nov 2012 03:23:52 GMT; Path=/ {"return": { "token": "6d1b722e", "start": 1363805943.776223, "expire": 1363849143.776224, "user": "saltuser", "eauth": "pam", "perms": [ "grains.*", "status.*", "sys.*", "test.*" ] }}
and you can see the token in it "token": "6d1b722e"
Now you can send your request containing a token explained by the bow as Auth-Token .
EDIT 2:
remember that you use pam for authentication, and that means you must have the same user in your os EDIT 3:
and in idle mode use this minimal con as salt-api conf
external_auth: pam: saltuser: - .* rest_cherrypy: port: 8000 disable_ssl: True host: 0.0.0.0