API Developer Guide
How can we help?
Full Site Search

Password authentication

Sometimes if your platform does not support HTTP Basic authentication, you can pass the user's e-mail and password as log in credentials to authenticate your program.

If you registered through Sign in with Google, make sure to register a Ragic password before proceeding with this tutorial.

Please only use this when you can not authenticate with HTTP Basic Authentication.

You send a request for a session id with a valid e-mail and password. You can issue a HTTP request using the -d argument containing the id and password. The -c parameter will store sessionId in the cookie jar file specified:


curl --get -d "u=jeff@ragic.com" \
 --data-urlencode "p=123456" \
 -d "login_type=sessionId" \
-d api \
 -c cookie.txt \
 -k \
 https://www.ragic.com/AUTH

If authentication failed, server will return -1. If authenticated, you will receive a session id in the response like this:


2z5u940y2tnkes4zm49t2d4

Note that this authentication method is session based, and session is server dependent. You may need to modify the url based on the location of the account you wish to access. For example, https://ap8.ragic.com/AUTH for accounts that reside on server https://ap8.ragic.com.

To use the returned sessionId in future requests to remain authenticated, please include the sessionId in url parameter as sid=<YOUR_SESSION_ID> For example, https://www.ragic.com/demo/sales/1?sid=<YOUR_SESSION_ID>

The use of Ragic API will be covered in later chapters, just remember to include your session ID in this manner to remain authenticated.

If you would like to retrieve detailed info on the log in user, you can also provide an additional json=1 parameter so that Ragic will return a json object containing the details of the user.


curl --get -d "u=jeff@ragic.com" \
 --data-urlencode "p=123456" \
 -d "login_type=sessionId" \
 -d "json=1" \
-d api \
 -c cookie.txt \
 -k \
 https://www.ragic.com/AUTH

The returned format will look something like this:


{
"sid":"8xkz874fdftl116vkd3wgjq0t",
"email":"jeff@ragic.com",
"accounts":
  {
    "account":"demo",
    "ragicId":25,
    "external":false,
    "groups":["EVERYONE","SYSADMIN"]
  }
}

Top of Page Table of Contents

Start Ragic for Free

Sign up with Google