How to search an API

I have access to an XML API in the form of the following link as an example, but I want to create a search box (in so that users can search for the data with a set of the parameters and return/display the results based on their parameters selected e.g. holiday websites;q=holidays;limit=10;minPrice=10?token=96CC0E0A10851500F10431D64EC5585BFC8597DF",false);

Can you please advise on an easy method to achieve this?

thanks in advance


Have you tried any code yet of what you are trying to achieve? Give it a try yourself and ask specific questions here with code snippets and we will be more than willing to help. But at the moment, this question is pretty broad


Ok at the moment I can display the data from the API as shown below in the code. This works but it just shows everything in the api URL, which at the moment shows holidays, under 10 as an example. I want to use a search box on a page (page 1) so that the search parameters are passed to the page below (page 2) and return the results based on the search parameters. for example, a user enters the following parameters in the fields of a search box: hotel, paris, under a given price then they submit them to page 2. , so I want to pass the search parameters from page 1 with a search box to the one below (page 2), but not sure how this will fit in as the first page will have a search box in and the one below is with javascript using Get Method.

Page 2 sample: 
if (window.XMLHttpRequest) {
    //Firefox, Opera, IE7, and other browsers will use the native 
    xmlhttp = new XMLHttpRequest();
    //IE 5 and 6 will use the ActiveX control
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");


Any advise / help would be appreciated


Ok, Firstly, I would just send the parameters from page 1 to page 2 with GET parameters. Eg.

Then on the second page, if you really want to do it with javascript, you can. But it would probably be best to grab those parameters on page load in .net and do the http request server side. Then just process the results to display it client side

Ok thanks. Doing it purely in .net sounds the best option. The first page is not issue as I can pass the parameters to the second page, but on the second page to get the API data and iterate through the data in the xml, how do I do it in I am not keen on using javascript or client side and prefer to use server side, but not sure about the actual syntax of doing in Are there any examples or tutorials you can point me to ?
Note the provider only provides me with the following link which is the API in xml


Thanks again

Yes, there are plenty of tutorials online when for dealing with xml in Google will help you out

Here are a few examples I found doing a quick google search:


1 Like

Thanks. Just one thing, the example shown and some of the ones i found, only shows how to read or manipulate an xml file that is located on the host server, but I am looking for examples on how to manipulate an xml from a url (API) e.g. http://api

Any ideas and preferably in as a few are in C Sharp



I am not sure what you mean. ASP.NET is a framework and C# is a language used to write on the ASP.NET framework. Do you mean you are using VB.NET(which is another language used to write on the ASP.NET framework)?

To load XML from an API, you just need to load it from a WebClient. Do a request and read the response:

Hi sorry meant The example you referenced has errors so not sure if there are other ones that are accurate

Ok found a way to do it and getting there but…I keep getting this error: (name is neither a DataColumn nor a DataRelation for table result.)
not sure why it doesnt display ‘name’ element from the xml file.
Below is both the code and the actual xml content.
Any advise and help would be appreciated

sub Page_Load
if Not Page.IsPostBack then
   dim myproducts=New DataSet
end if
end sub
<form runat="server">
<asp:Repeater id="products" runat="server">

<table border="1" width="100%">

  <div>City: <%#Container.DataItem("name")%></div>

The xml file content from the url:

<result xmlns="urn:com:example:pf:model:xml:output" xmlns:ns2="urn:com:tradedoubler:pf:model:xml:common" version="3.0">
<product language="en">...</product>
<product language="en">
<ns2:name>Pisa Holidays</ns2:name>
<ns2:description>Pisa Holidays</ns2:description>

This post has been reformatted by enclosing the code block in 3 backticks
on their own lines.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.