All About Triand

Find articles, help, and advice with Triand.

API Access

Last Updated: Jan 31, 2012 08:44AM CST

API Access

API Access allows your developers to interact programmatically with Triand.

Enabling API Access


You must be subscribed to the District plan. You can check your plan by visiting your account page.
Click 'Create an API key' to enable API access.
You will immediately receive an API key:

Using Triand authentication with your site


With an API Access key you can use Triand's authentication on your site. Your users will never leave your site and you can maintain a consistent look and feel (branding) through the user's log in experience.
Change your login form to have the following:
Some rules: •form must post to 'https://my.triand.com/login_redirect.html' •email field must be named 'email', you give it any id you want •password field must be named 'password', you give it any id you want •must have a hidden field named 'api_key' with the api key from your account page • must have a hidden field named 'redirect_url' with the page on your site where you want the user to be redirected upon login.
Don't forget to view the page source.

Security

Your login page should be using SSL.
Your redirect_url should be using SSL.
The first time you login using your api key your redirect_url is captured. Subsequent logins must use the same redirect_url. If you need to change your redirect_url you will need to delete your API Access key and create another one.

The redirect to your site

When a post is done to http://my.triand.com/login_redirect.html the browser is immediately redirected to the redirect_url with one additional url parameter (trd).
For instance, if your redirect_url is 'https://www.my_domain.com/do_login.html' then the browser will redirect to: https://www.my_domain.com/do_login.html?trd=eyJzY2hvb2xfbmFtZSI6IiIsInZhb...
Note that the url parameter trd is usually pretty long and has been shortened in the above example.

Decoding login information

        { 
        "valid_login":1,
        "email":"emailaddress@triand.com",
        "first_name":"Bob",
        "last_name":"Smith",
        "triand_id":"123456789",
        "us_state":"AR",
        "district_name":"Triand ISD",
        "district_cd":"123456789",         (State-ID for district)
        "school_name":"",
        "school_cd":"123456789",           (State-ID for school)
        "is_principal":false,
        "is_teacher":false,
        "school_level":true,
        "district_level":true,
        "state_level":false,
        "can_view_students_for_school":true,
        "can_view_students_for_district":true,
        "can_view_students_for_state":false
        }