You are on page 1of 2

string sOAuthURL =

"https://partnersolutionsconnectproxy.verizon.com:443/oauth/client_credential/acces
stoken?grant_type=client_credentials";
string sClientID = "Your Key"; // "test";
string sClientSecret = "Your Secret"; // "test";
string sToken = GetOauthToken(sOAuthURL, sClientID, sClientSecret);
string sServiceQualURL =
"https://partnersolutionsconnectproxy.verizon.com:443/v1/ftti/serviceQualification"
;
string sResult = CallServiceQualificationAPI(sServiceQualURL, sToken);

public static string GetOauthToken(string url, string sClientID, string


sClientSecret)
{
HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(url);
webrequest.Method = "Post";
webrequest.Headers["Authorization"] = "Basic " +
Convert.ToBase64String(Encoding.Default.GetBytes(sClientID + ":" + sClientSecret));
webrequest.ContentType = "application/json";
webrequest.ContentLength = 0;
HttpWebResponse webresponse =
(HttpWebResponse)webrequest.GetResponse();
Encoding enc = System.Text.Encoding.GetEncoding("utf-8");
StreamReader responseStream = new
StreamReader(webresponse.GetResponseStream(), enc);
string result = string.Empty;
result = responseStream.ReadToEnd();
webresponse.Close();
var oauthresponse = new
System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<OAuthResponse>(r
esult);
return oauthresponse.access_token;
}

public static string CallServiceQualificationAPI(string url, string


sBearerToken)
{
HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(url);
webrequest.Method = "Post";
webrequest.Headers["Authorization"] = "Bearer " + sBearerToken;
webrequest.ContentType = "application/json";
webrequest.Headers["authType"] = "OAUTH";
webrequest.Headers["CC"] = "XYZ";

string sJson =
"{ \"messageId\": \"BROADBAND20170320\", \"interactionDate\": \"201703201547896523\
", \"companyCode\": \"XYZ\", \"stateOrProvince\": \"VA\", \"workingTelephoneNumber\
": \"7035607355\" }";
using (var streamWriter = new
StreamWriter(webrequest.GetRequestStream()))
{
streamWriter.Write(sJson);
streamWriter.Flush();
streamWriter.Close();
}
HttpWebResponse webresponse =
(HttpWebResponse)webrequest.GetResponse();
Encoding enc = System.Text.Encoding.GetEncoding("utf-8");
StreamReader responseStream = new
StreamReader(webresponse.GetResponseStream(), enc);
string result = string.Empty;
result = responseStream.ReadToEnd();
webresponse.Close();
return result;
}

}
}

Bolloju, Prudhvi3:51 PM
for oauth implementaiton...first u need to create a product. If developers want to
access the application/product they must need client ID and secret key. The
api/product which we are dealing with is ServiceQualification API. I already shared
u client ID and secret key.

PB
Bolloju, Prudhvi3:52 PM
so we call OAUTH URL with the mentioned ID and secret
when we call it we will get a access token
we then place the access token as Bearer token and will call the main target
endpoint

PB
Bolloju, Prudhvi3:53 PM
so the OAuth mechanism gets applicaple to the target endpoint
and with that security feature we will get the response.(whether 200 ok, etc etc)

PB
The doc which i sent u in mail is in c sharp

they are asking to implement it in java using header values and response in JSON
format

apikey - T2QW0GpI3wdPHhpXQtFOhrR9yUlAnyLs
Secret key - A9J6Gk9pVZR1VV5s

You might also like