I am trying to use the DigitalNZ API to retrieve data and integrate it with other data held in a SQL database. My plan is that my
ASP.NET web site will create a query for the DigitalNZ API, then use the information returned in combination with information it its own database.
My first test query was: -
http://api.digitalnz.org/v3/records.xml?api_key=xxxxxxxx&text=Freda+Cook&fields=verboseThis
returned XML from which I can get everything I want about the first 20
records. The query tells me that there are 744 records that I might be
interested in. It was relatively easy to put the XML into an XMLDocument
and extract the information that I wanted into a table in my
server-side
ASP.NET code.
I then tried to explore the query language to find out what I could do with it. I need the fields
id, title, and
subject, and
source_url would also be useful, but I don't need other fields in the returned data (although I do want to include
date in
the query - more of this later), so I replaced "fields=verbose" with
"fields=id,title,source_url,subject". The query now returned only
title and
subject, but
id and
source_url were not included. (I tried both
source_url and
source-url, but it made no difference).
If I could write a SQL query I'd write
Set @Name = 'Freda Cook'
Set @Year1 = 1896
Set @Year2 = 1990
SELECT id, title, subject, source_url FROM DigitalNZAPI WHERE text=@Name AND Date>=@Year1 AND Date <=@Year2
How do I write the equivalent query through the DigitalNZ API? At the moment the only way I can see to do what I want is to return everything (Fields=verbose,) and throw away the fields that I don't want, and the records that I don't want because they have incorrect dates).
Thank you, Robert Barnes.