New Zealand (NZ) My Account

Zenbu REST API

The Zenbu REST API allow third parties to access and update the content of the Zenbu website. There are no commercial boundaries on the API for up to 10,000 requests per day - above that and you have to work out a deal with us. Please respect our Creative Commons Attribution License.

You may also be interested in our search API.

First you will need a Zenbu API Key

Authentication

Currently HTTP Basic Auth.


Zenbu REST API Method: GET /entries/showapi/:entry

Returns the details of the specified entry.
URL:
https://nz.zenbu.org/entries/showapi/entry_id.format
Formats:
xml
HTTP Method(s):
GET
Requires Authentication:
false
Parameters:
entry_id. Required. The id of the entry.
Response :
HTTP/1.1 200 OK
HTTP/1.1 404 Not Found
Usage examples:
curl https://nz.zenbu.org/entries/showapi/1120748.xml
HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<entry>
  <correctly-placed type="boolean">true</correctly-placed>
  <country>NZ</country>
  <created-at type="timestamp">Sat Feb 02 11:25:57 +1300 2008</created-at>
  <facebook_page></facebook_page>
  <gisprecision>number</gisprecision>
  <id type="integer">1120748</id>
  <latitude type="float">-36.878228</latitude>
  <longitude type="float">174.732838</longitude>
  <name>Briscoes Homeware - St Lukes</name>
  <opening-hours></opening-hours>
  <other-contact-details nil="true"></other-contact-details>
  <phone>(09) 815 3730</phone>
  <physical-address>36 Taylors Road, Morningside</physical-address>
  <removed type="boolean">false</removed>
  <tags>Homeware, home decor, bedding</tags>
  <updated-at type="timestamp">Sat Feb 02 11:25:57 +1300 2008</updated-at>
  <updated-by>zenbu</updated-by>
  <version type="integer">1</version>
  <website>http://www.briscoes.co.nz/</website>
  <why-removed></why-removed>
</entry>

Zenbu REST API Method: PUT /entries/:entry

Update the details of the specified entry.
URL:
https://nz.zenbu.org/entries/entry_id.format
Formats:
xml
HTTP Method(s):
PUT (clients who can not issue PUT requests can POST with the added parameter _method=PUT)
Requires Authentication:
true
Parameters:
entry_id. Required. The id of the entry.
Response :
HTTP/1.1 200 OK
HTTP/1.1 422 Errors in data
Usage examples:
cURL: to update the phone number only of entry 1120748
curl -u user:password -v -X PUT -H 'Content-Type: application/xml' -d "<?xml version="1.0"?><entry><phone>09 815 3730</phone></entry>" https://nz.zenbu.org/entries/1120748.xml
HTTP/1.1 200 OK

Zenbu REST API Method: POST /entries

Create a new entry.
URL:
https://nz.zenbu.org/entries.format
Formats:
xml
HTTP Method(s):
POST
Requires Authentication:
true
Parameters:
N/A
Content parameters:
name: required
country: required
correctly_placed,facebook_page,gisprecision,latitude,longitude,name,opening_hours,other_contact_details,phone,physical_address,refs,removed,tags,website,why_removed
Response :
HTTP/1.1 201 Created
HTTP/1.1 422 Errors in data
Usage examples:
cURL:

Create the most basic entry, name and country

curl -u user:password -v -X POST -H 'Content-Type: application/xml' -d "<?xml version='1.0'?><entry><name>Test entry 3</name><country>NZ</country></entry>" https://nz.zenbu.org/entries.xml
HTTP/1.1 201 Created

Creating an entry that is a possible duplicate of another will return the list of possible matches and details

curl -u user:password -v -X POST -H 'Content-Type: application/xml' -d '<?xml version="1.0"?><entry><correctly-placed type="boolean">true</correctly-placed><country>NZ</country><gisprecision>manual</gisprecision><latitude type="float">-39.05759</latitude><longitude type="float">174.071894</longitude><name>Ariki Backpackers</name><opening-hours></opening-hours><other-contact-details nil="true"></other-contact-details><phone>06 769 5020</phone><physical-address>25 Ariki Street, New Plymouth, Taranaki</physical-address><tags>Accommodation, Backpackers</tags><website>http://www.arikibackpackers.com</website></entry>' https://nz.zenbu.org/entries.xml
HTTP/1.1 422 Errors in data
<?xml version="1.0" encoding="UTF-8"?>
<matches>
<entry>
  <correctly-placed type="boolean">true</correctly-placed>
  <country>NZ</country>
  <created-at type="timestamp">Sat Dec 05 15:34:24 +1300 2009</created-at>
  <gisprecision>manual</gisprecision>
  <id type="integer">1170740</id>
  <latitude type="float">-39.05759</latitude>
  <longitude type="float">174.071894</longitude>
  <name>Ariki Backpackers</name>
  <opening-hours>8.30am - 9pm Late Arrivals By Arrangement</opening-hours>
  <other-contact-details>P.O.Box 8191
New Plymouth
Taranaki</other-contact-details>
  <phone>06 769 5020</phone>
  <physical-address>25 Ariki Street, New Plymouth, Taranaki</physical-address>
  <removed type="boolean">false</removed>
  <tags>Accommodation, Backpackers</tags>
  <updated-at type="timestamp">Sun Dec 06 21:12:48 +1300 2009</updated-at>
  <updated-by>zenbu</updated-by>
  <version type="integer">2</version>
  <website>http://www.arikibackpackers.com</website>
  <why-removed></why-removed>
</entry>
</matches>

The preferred solution is to provide an option to edit the duplicate rather than create a new entry.

Creating an entry that is an exact duplicate of another (and including the duplicate-override parameter) will still give an error.

curl -u user:password -v -X POST -H 'Content-Type: application/xml' -d '<?xml version="1.0"?><entry><correctly-placed type="boolean">true</correctly-placed><country>NZ</country><gisprecision>manual</gisprecision><latitude type="float">-39.05759</latitude><longitude type="float">174.071894</longitude><name>Ariki Backpackers</name><opening-hours></opening-hours><other-contact-details nil="true"></other-contact-details><phone>06 769 5020</phone><physical-address>25 Ariki Street, New Plymouth, Taranaki</physical-address><tags>Accommodation, Backpackers</tags><website>http://www.arikibackpackers.com</website><duplicate-override type="boolean">true</duplicate-override></entry>' https://nz.zenbu.org/entries.xml
<errors>
  <error>Already another entry with that exact name at that exact location</error>
</errors>
About Zenbu
Creative Commons License
Zenbu content is licensed under a Creative Commons Attribution 3.0 License