login()

Pixelsilk API function to log in to the site
Parameters:
username: the username of the user logging in
password: the password of the user logging in

Output:
The function login returns an object containing the authorization cookie for the user and the user token

C# Example:
string username = "userName";
string password = "passWord";
object authObj = Login(username, password);
Note the capital first letter of the C# method.

HTTP Example:
Request:
POST /api2/login HTTP/1.1
Host: www.example.com
Content-Length: 70
Content-Type: application/x-www-form-urlencoded

json=%7B%22username%22%3A%22spider%22%2C%22password%22%3A%22web%22%7D

Response:
HTTP/1.1 200 OK
Content-Type: text/javascript; charset=UTF-8
Content-Length: 306

{"auth":"41C68AFB218F088A3F7A1D82F78D3A...92F5EEBD7AA6B1FA2AF75F", "token":"7AdbNHFQBt...lzRFTEK8UvSUQ="}

JavaScript Example:
Method Call:
pixelsilk2.login(input, callback);

Input Object:
{
    username:"bsmith",
    password:"A8zl2@uur"
}

Returned Data:
{
    "auth":"7C4B32DBA3E4509D97...1898E071D2188F50",
    "token":"7AdbNHZQB...zRPTEK8UvSUQ="
}

Back to Users »