366 Degrees

366 Web API

Authentication

Description:This will allow you to get Authentication Token for Open drip campaigns in 366 Degrees.
Method: Authenticate
URL:https://api.366.io/DripCampaignApis/api/Authenticate
 

Try it out

Authentication Information

 
Authorization Token
 

Sample Code

MVC Code

[HttpPost]
public ActionResult DetailsById(Campaign cam)
{
var result = string.Empty;
var finalresult = string.Empty;
dynamic json;
try
{
var postReq = (HttpWebRequest)WebRequest.Create(ConfigurationManager.AppSettings["Authenticate"].ToString());
postReq.Method = "POST";
postReq.ContentType = "application/x-www-form-urlencoded";
postReq.Headers.Add("appkey", cam.Key);
postReq.Headers.Add("secretkey", cam.Secret);
postReq.Headers.Add("datasource", cam.DataSource);
var dataStream = postReq.GetRequestStream();
dataStream.Close();
var response = postReq.GetResponse();
dataStream = response.GetResponseStream();
if (dataStream != null)
{
var reader = new StreamReader(dataStream);
result = reader.ReadToEnd();
reader.Close();
finalresult = JsonConvert.SerializeObject(result);
}
dataStream?.Close();
response.Close();
json = JsonConvert.DeserializeObject(finalresult);
}
catch (Exception ex)
{
throw ex;
}
return Json(json, JsonRequestBehavior.AllowGet);
}

JQuery Code

$('#Dripsubmit').click(function ()
{
var cam = {
Key: $("#Key").val(),
Secret: $("#Secret").val(),
DataSource: $("#DataSource").val() ? $("#DataSource").val():"366Degrees"
};
$.ajax({
url: "/OpenDripCampaign/Authenticate",
type: "POST",
contentType: "application/json;charset=utf-8",
data: JSON.stringify(cam),
dataType: 'json',
timeout: 1200000,
async: true,
success: function (data) {
//Success Data
},
error: function (err) {
alert('Error')
}
});
});

Json Output Sample

{
Authorization Token : "Y2xpZW50SWQ9MTMyMSxwYXJ0bmVySWQ9MSxkYXRhc291cmNlPU5pbWJsZQ==",
}