how to correctly use curl command line with Services module? I try to use following command to create an user:

$ curl -H 'Content-type: application/json'  -d '{"name":"u10", "pass": "123","mail": "user@a.om"}' http://localhost/test/api/user/register


return success: 

{"uid":"11","uri":"http://drupal/daxuebao/api/user/11"}


But I try to login:

$ curl -H 'Content-type: application/json'  -d '{"username":"u10", "password": "123","mail": "user@a.om"}' http://localhost/test/api/user/login


It alert me :

["Wrong username or password."]


So, How to correctly use curl command line?
You need to send only username and password. Mail is not required.. Please check the documentation here...

$base_url = 'http://localhost/test_endpoint';
$data = array(
  'username' =&gt; 'admin',
  'password' =&gt; 'password',
);
$data = http_build_query($data, '', '&amp;');
$headers = array();
$options = array(
  'headers' =&gt; array(
    'Accept' =&gt; 'application/json',
  ),
  'method' =&gt; 'POST',
  'data' =&gt; $data
);
$response = drupal_http_request($base_url . '/user/login', $options);
$data = json_decode($response-&gt;data);
// Check if login was successful
if ($response-&gt;code == 200) {
  // Now recycle the login cookie we recieved in the first request
  $options['headers']['Cookie'] = $data-&gt;session_name . '=' . $data-&gt;sessid;
  // Get info about a user
  $data = array();
  $options['data'] = http_build_query($data, '', '&amp;');
  $options['method'] = 'GET';
  $response = drupal_http_request($base_url . '/user/32', $options);
}


Below one worked for me

curl -H 'Content-type: application/json'  -d '{"username":"admin", "password": "admin"}' http://localhost/d7/testendpoint/user/login


In your case it should be

curl -H 'Content-type: application/json'  -d '{"username":"u10", "password": "123"}' http://localhost/test/api/user/login