user3173098
user3173098

Reputation: 99

How to do an API call in ASP.NET (VB)

I want to make an API call where the response is in XML format.

This is the API description: http://www.dictionaryapi.com/products/api-collegiate-dictionary.htm

I have registered and I have a key to use in the request URL.

Could anyone give me an idea of how to make the call and analyse the response?

Thankyou.

Upvotes: 0

Views: 83

Answers (1)

kravits88
kravits88

Reputation: 13049

Something along the lines of:

var request = WebRequest.Create("http://www.dictionaryapi.com/api/v1/references/collegiate/xml/hypocrite?key=1234");
var response = request.GetResponse();    
var xdoc = XDocument.Load(response.GetResponseStream());

Then you can grab what you need like:

xdoc.Element("ElementName");

Upvotes: 1

Related Questions