Open API for TrapNZ would be very useful

#1

Could an open API be made available for TrapNZ, so that request could be made with a key. XML or JSON would be fine.

That would enable other uses to be made of trapping data. For example, I would like to be able to use the API to get trap data for my project and use it with other applications.

1 Like
#2

Hi @mikepeters

This post has some info on getting data ins as XML and other formats. An “All trap records” layer has been added. It uses basic auth rather than a key, however.

There will be an API for public map feeds, and we plan to switch to using that for private feeds like the ones above. We’ll make an announcement when this becomes available.

#3

Please could you clarify the way that the url needs to be entered for basic auth on something like Arcgis online?
Would it be in the form:
https://username:password@trap.nz/wms/features/000000
I’m attempting this simply in a web browser and i get redirected to https://trap.nz/wms/features/0000000
and it returns:
<result>Access denied for user anonymous</result>

#4

Hi @root
Many thanks - an open API with a key would enable other non GIS uses that people might think of. For example - Connecting trap data to google calendar. Connecting with project management systems etc. The key would be additional to projectID. Each key would be unique to a user.

Xero has great documentation and examples of how their API works as does Google. So far there are 20,000 other open API’s available and growing daily

#5

No mind. The username/password prefix doesn’t seem to work, you need a client that can send basic authentication like QGIS (which is free vs Arcgis)
An API key as @mikepeters mentions would be handy too.

#6

Thanks Mike - we do have an open API and will document the feeds as they become available.

#7

Cheers David - yes modern browsers don’t let you do the username/password prefix any more!

#8

Hello, I’m working for a client that would like to display trap information on their website. I’ve seen the methods for using https://trap.nz/wms/features/, but I’m not sure how to obtain a username/password to use this service. Are there any updates on the availability of an open API for trap data? Is a paid one available? Thanks!

#9

Hello,
I have done something with https://www.pestfreeporirua.org.nz/
See each suburb in the project directory.
This consumes the project summary data which is available as a json feed. I’m using Wordpress for the website and a table plugin to render the data into a table.

You have to enable “Share Summary Data” on the project page in trap.nz and the you can use a URL including the project id to get the data in json form.

You don’t get any choice about what data is returned.
See this for the information on how to build the URL to obtain the data.

https://api.trap.nz/docs/trapnz-data-feeds

(The rest of the API is about logging data to the site from sensors on traps and not for extra into data)

#10

David that’s excellent - It looks very doable. I’ll set up something similar for the Mt Chocolate website once we start catching anything.
Mike

#11

Hi there, for the username and password you just use your usual credentials for the website. You need to be at least a read-only member for each project you will be getting the wms data from.
There are some threads I started regarding getting data out of Trap.nz to make gis reports using qgis which have some information on providing credentials- one thing that you might get stuck on is that the website lets you login with your email address as your username, but the api only lets you use your username.