Bulk Example

Shortcuts:
Clarizen .Net wrapper: http://clarizen.caglar.com
Sample .Net project: Download samples.zip or browse/fork on GitHub

Login

using System;
using Clarizen.API.V2_0;

namespace ClarizenSamples.Authentication
{
    class Login
    {
        static Login()
        {
            API ClarizenAPI = new API();
            if (!ClarizenAPI.Login("username", "password"))
                return;

            Console.WriteLine("Login successful");
            Console.WriteLine("Server location: {0}", ClarizenAPI.serverLocation);
            Console.WriteLine("Session Id: {0}", ClarizenAPI.sessionId);

            // Your API code goes here...

            if (ClarizenAPI.Logout())
                Console.WriteLine("Logout successful. {0} API calls made in this session", ClarizenAPI.TotalAPICallsMadeInCurrentSession);
        }
    }
}

GetSessionInfo

using System;
using Clarizen.API.V2_0;
using Clarizen.API.V2_0.Authentication;
using ObjectDumper;

namespace ClarizenSamples.Authentication
{
    class GetSessionInfo
    {
        static GetSessionInfo()
        {
            API ClarizenAPI = new API();
            if (!ClarizenAPI.Login("username", "password"))
                return;

            getSessionInfo sessionInfo = ClarizenAPI.GetSessionInfo();
            if (sessionInfo.IsCalledSuccessfully)
                Console.WriteLine(sessionInfo.Data.DumpToString("getSessionInfo"));
            else
                Console.WriteLine(sessionInfo.Error);

            if (ClarizenAPI.Logout())
                Console.WriteLine("{0} API calls made in this session", ClarizenAPI.TotalAPICallsMadeInCurrentSession);
        }
    }
}

Comments