Click here to Skip to main content
15,910,277 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to use ipviking code in c#.....?
I have the API key and when i use these key in my program its through error(400 Bad Request)

Can any one help me?
my code is
C#
WebRequest request = WebRequest.Create("http://beta.ipviking.com/api/&apikey=** REMOVED **&method=ipq&ip=202.104.251.200");
request.Method = "POST";

string postData = "D={\"requests\":[{\"C\":\"Gpf_Auth_Service\", \"M\":\"authenticate\", \"fields\":[[\"name\",\"value\"],[\"Id\",\"\"],[\"username\",\"user@example.com\"],[\"password\",\"ab9ce908\"],[\"rememberMe\",\"Y\"],[\"language\",\"en-US\"],[\"roleType\",\"M\"]]}],  \"C\":\"Gpf_Rpc_Server\", \"M\":\"run\"}";
byte[] byteArray = Encoding.UTF8.GetBytes(postData);

request.ContentType = "application/x-www-form-urlencoded";

request.ContentLength = byteArray.Length;

Stream dataStream = request.GetRequestStream();

dataStream.Write(byteArray, 0, byteArray.Length);

dataStream.Close();

WebResponse response = request.GetResponse();

dataStream = response.GetResponseStream();

StreamReader reader = new StreamReader(dataStream);

string responseFromServer = reader.ReadToEnd();

Console.WriteLine(responseFromServer);

reader.Close();
dataStream.Close();
response.Close();
return View();
Posted
Updated 9-Jul-13 1:31am
v3

1 solution

You should talk to the people who created it - https://ipviking.com[^] - they should provide technical support and will know more about their product than we will. If they don't, then find another supplier and demand your money back!
 
Share this answer
 
Comments
[no name] 9-Jul-13 7:03am    
not any support from that side..
Dave Kreskowiak 9-Jul-13 7:31am    
Then don't use the site. I wouldn't be using unsupported API's in production code.
OriginalGriff 9-Jul-13 7:37am    
Pretty much exactly what I was going to say (but politer)! :thumbsup:
Dave Kreskowiak 9-Jul-13 8:34am    
Sorry, I'm fresh out of "polite" this week!
OriginalGriff 9-Jul-13 8:40am    
No, I meant that your version was politer than mine was going to be! :laugh:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900