Created
April 10, 2018 13:08
-
-
Save MattCordell/705545f3b057b5a02f087b210a3bdb69 to your computer and use it in GitHub Desktop.
LoginWithLingoAPI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using RestSharp; | |
namespace D_Punch | |
{ | |
public class LingoCredential | |
{ | |
public string password { get; set; } | |
public string username { get; set; } | |
} | |
class Program | |
{ | |
static void Main() | |
{ | |
string endpoint = "http://lingo-uat.cti:8080/lingo/rest"; | |
string PostLogin = "/security/login"; | |
LingoCredential login = new LingoCredential(); | |
login.username = ""; | |
login.password = ""; | |
var client = new RestClient(endpoint); | |
var loginRequest = new RestRequest(PostLogin, Method.POST); | |
loginRequest.AddJsonBody(login); | |
CookieContainer jar = new CookieContainer(); | |
client.CookieContainer = jar; | |
var resp = client.Execute(loginRequest); | |
Console.WriteLine("LINGO Login: " + resp.StatusCode); | |
Console.WriteLine("Finished"); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment