A UserKey can be used to authenticate in lieu of a Username and Password. Additionally, a UserKey remains constant, whereas a password will change periodically. So it is important to obtain a UserKey for long-term repeated authentication.
When calling the method '/authenication', you will want to use Basic Authentication (see: Authentication Methods).
There are no required parameters or query strings, so this call is as simple as it gets!
Note: The APIKey used in this example will not work on this method. If you do not already have your own set of credentials, you will have to email in a request.
Below is a sample '/authentication' request in C#
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("https://smf.crm3.redtailtechnology.com/api/public/v1"); req.Headers[System.Net.HttpRequestHeader.Authorization] = "Basic " + Convert.ToBase64String(System.Text.Encoding.Default.GetBytes("6C135EDF-C37C-4039-AEF3-5DFC079F9E6A:Statementone:sonedemo")); req.Method = "GET"; req.ContentType = "text/xml";
//and here's the response stream.
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
The output will be similar to the following
Sample Response(JSON) |
{"APIKey":"6C135EDF-C37C-4039-AEF3-5DFC079F9E6A", "CID":5999,
"DatabaseID":99999,
"Message":Success,
"Name":null,
"ReturnURL":null,
"Status":1,
"UserID":41974,
"UserKey":"B7B4BCDD-67C8-449C-B1D4-C1AAFE49703D"}
|
Comments