Quote:
Originally Posted by tbworld
I never know how to answer that question. It can be done. The company I work for has incorporated vbulletin in our company app. We only incorporated the parts of vbulletin we were interested in as we wanted it very specialized.
vBulletin Mobile API
http://www.vbulletin.com/vbcms/conte...334-mobile-api
vBulletin Source
/includes/api/
|
Thank you for your responce.
Now i am stuck with an error "invalid_api_signature " while trying to login.
I am doing the Integration using C#.
I called api_init and i got the apiversion, apiaccesstoken, vbulletinversion, apiclientid and secret.
Then i called login_login and passed apiclientid, apiversion, apiaccesstoken and api_sig as query string. I have passed vb_login_username and vb_login_md5password as content.
Please see the below C# code for creating the api_sig and for creating a http post request.
/////// C# Code /////////////////////////////
apiVersion = HttpUtility.UrlEncode(apiVersion);
apiAccessToken = HttpUtility.UrlEncode(apiAccessToken);
vBulletinVersion = HttpUtility.UrlEncode(vBulletinVersion);
apiClientId = HttpUtility.UrlEncode(apiClientId);
secret = HttpUtility.UrlEncode(secret);
apiKey = HttpUtility.UrlEncode(apiKey);
using(MD5 md5Hash = MD5.Create())
{
md5Password = GetMD5Hash(md5Hash, password);
}
string login_string = "api_m=login_login" + "&vb_login_username=" + userName + "&vb_login_md5password=" + md5Password;
using (MD5 md5Hash = MD5.Create())
{
api_sig = GetMD5Hash(md5Hash, login_string + apiAccessToken + apiClientId + secret + apiKey);
api_sig = HttpUtility.UrlEncode(api_sig);
}
String login_request = "vb_login_username=" + userName + "&vb_login_md5password=" + md5Password + "&cookieuser=true";
String request = "?api_c=" + apiClientId + "&api_v=" + apiVersion + "&api_m=login_login" + "&api_s=" + apiAccessToken + "&api_sig=" + api_sig;
url = url + request;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = login_request.Length;
CookieContainer a = new CookieContainer();
req.CookieContainer = a;
System.Net.ServicePointManager.Expect100Continue = false; // prevents 417 error
using (StreamWriter writer = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII))
{
writer.Write(login_request);
}
response = (HttpWebResponse)req.GetResponse();
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
//cookie = reader.ReadToEnd();
JavaScriptSerializer js = new JavaScriptSerializer();
jsonResp = js.Deserialize<Dictionary<string, object>>(reader.ReadToEnd());
}
Please help me on this. If it is wrong can you please give me some sample code for creating api_sig in C#. I have implemented this code in C# for creating api_sig by looking at one of the posts where the code was in PHP. Below is the link which i took as a reference for creating the api_sig.
https://vborg.vbsupport.ru/showthread.php?p=2321926%20
Thanks