NakdReality logo
The AR search service with instant gratification

Developer API - KISS Engine

BETA

Synopsis

The following API calls are demonstrated using the wget command-line utility from Linux - but you can make these HTTP calls with your favourite language instead. Search uses GET and all other requests use POST.

In examples where XML is used in the 'data' field, you can also choose to use JSON or CSV instead. See the 'format' field for how to specify this. We recommend either XML or JSON, however.

NOTE: you should not publicly disclose your key. For instance, if you intend to perform one of the POST request calls within javascript in a client-side web browser, you should first create a small server-side script to perform the call which uses your key, and call that from within javascript, instead of directly calling the nakdreality service.

Search for points in the KISS testbed (from Timbuktu) with a search query of "test search"

wget -qO- 'http://www.nakdreality.com/search?lat=16.77&lon=-3.02&layerName=nakdrealitytestkiss&SEARCHBOX=test+search'

Search for points in the KISS testbed (from Timbuktu) without a search query

wget -qO- 'http://www.nakdreality.com/search?lat=16.77&lon=-3.02&layerName=nakdrealitytestkiss'

Insert a point into the testbed: e.g. add a new person (name = Joe Bloggs) using the social API, and check them into a new venue (latitude 16.775, longitude -3.025) near Timbuktu:

wget -qO- http://www.nakdreality.com/insert --post-data='api=social&layer=nakdrealitytestkiss&key=8dC8mH5bWbg7shd&format=xml&data=<?xml version="1.0" encoding="utf-8"?><data><line><name>Joe Bloggs</name><latitude>16.775</latitude><longitude>-3.025</longitude></line></data>'

Update a point on the testbed: e.g. change "Joe Bloggs", who the response said was personID 0000000001, to "Jim Bloggs"

wget -qO- http://www.nakdreality.com/update --post-data='api=social&layer=nakdrealitytestkiss&key=8dC8mH5bWbg7shd&format=xml&data=<?xml version="1.0" encoding="utf-8"?><data><line><personID>0000000001</personID><name>Joe Bloggs</name><latitude>16.775</latitude><longitude>-3.025</longitude></line></data>'

Delete a point on the testbed: e.g. remove person "Joe Bloggs" (Which will also remove their checkins. To keep the person and remove their checkin, use the checkinID instead of the personID in the delete data.)

wget -qO- http://www.nakdreality.com/delete --post-data='api=social&layer=nakdrealitytestkiss&key=8dC8mH5bWbg7shd&format=xml&data=<?xml version="1.0" encoding="utf-8"?><data><line><personID>0000000001</personID></line></data>'

Upload an image to the testbed: (Note the fake image data XXXXXX - this needs to come via a multi-part POST file upload form)

wget -qO- http://www.nakdreality.com/insert --post-data='api=document&layer=nakdrealitytestkiss&key=8dC8mH5bWbg7shd&format=xml&image_data=XXXXXXXXXX&data=<?xml version="1.0" encoding="utf-8"?><data><line><personID>0000000001</personID><scale_width>100</scale_width><scale_height>100</scale_height></line></data>'

Select a point from the testbed:

wget -qO- http://www.nakdreality.com/select --post-data='api=social&layer=nakdrealitytestkiss&key=8dC8mH5bWbg7shd&format=xml&data=<?xml version="1.0" encoding="utf-8"?><data><line><personID>0000000001</personID></line></data>'

Description

Searching for data:

Service URL: http://www.nakdreality.com/search?

CGI parameters for searching (based on the Layar GetPOIs format)

&layerName=[YOUR LAYER NAME]The globally unique name you entered on signup. Layar use the inconsistent 'layerName' parameter instead of just 'layer' as visible in their output data format, but we support both 'layer' and 'layerName' here.
&SEARCHBOX=[STRING]Optional search keywords. Yes, this parameter is capitalised.
&lat=[FLOAT]Your latitude (North/South location) in decimal degrees. 90 to -90
&lon=[FLOAT]Your longitude (West/East location) in decimal degrees. -180 to 180
&radius=[INTEGER]Optional radius in meters to confine the search within. Note that including a radius will not speed up the NakdReality KISS engine (unlike many other types of spatial engines which do not scale well as distance and data quantity increase), so you would want some other reason for including a radius.
&accuracy=[INTEGER]Optional accuracy in meters of the latitude/longitude location. Might be used to scale a map of your location so a highly accurate location will produce a large scale map, and an inaccurate location will produce a small scale map.
&pageKey=[INTEGER]Can be used to see more results. See the results for the morePages boolean, and the nextPageKey value, which can be input to the pageKey to see more results.
&html=[BOOLEAN]Not part of the official Layar format. An optional flag, which if set to '1', will indicate search results are intended for display in HTML, instead of an AR browser. This means that (a) Strings will be HTML encoded to avoid any XSS issues when displaying user-generated content, (b) A single 'description' field will be output, instead of the split 'line2', 'line3', 'line4', and 'attribution' fields, and (c) The length of the 'title' and 'description' fields will not be limited as much as the traditional Layar output.

The output from a search API call uses the JSON Layar response format as documented by AR company Layar. This allows our output to be viewed by the augmented reality Layar mobile phone app


Adding data:

Service URL: http://www.nakdreality.com/insert?

Updating data:

Service URL: http://www.nakdreality.com/update?

Deleting data:

Service URL: http://www.nakdreality.com/delete?

Selecting data:

Service URL: http://www.nakdreality.com/select?

Uploading image data:

Service URL: http://www.nakdreality.com/upload?

CGI parameters for insert, update, delete, select, and upload

&layer=[YOUR LAYER NAME]The globally unique name you entered on signup
&key=[API KEY]See your login page to obtain this
&format=[DATA FORMAT]e.g. json, xml, or csv
&api=[API TYPE]e.g. social, document, or shopping
&data=[SERIALISED DATA]this will contain the API data in the particular data format you specified. See the social, document, and shopping API formats further down this page for the parameters available within the serialised data.
&image_data=[SERIALISED IMAGE DATA]this will contain the binary image data for an 'upload' API call
&image_url=[URL]an optional alternative to image_data for an 'upload' API call -- NakdReality will download the image at this URL

The data parameter should be serialised data in your chosen format (json, xml, or csv) for the particular API you are using (social, document, or shopping)

There is a current size limit of 10M for any one insert command, so larger inserts should be cut into smaller chunks of 10M each.

Data content fields: (by API)

Social API

The social API features three sets of objects: people, venues, and checkins.

	Venue fields:
	    'venueID'
	    'venue'
	    'address'
	    'phone'
	    'description'
	    'latitude'
	    'longitude'
	    'accuracy'
	    'venueTime'

	Person fields:
	    'personID'
	    'published'
	    'url'
	    'name'
	    'information'
	    'rating'
	    'rating2'
	    'barcode'
	    'imageUrl'
	    'category'
	    'url2'
	    'url3'
	    'personTime'

	Checkin fields:
	    'checkinID'
	    'personID'
	    'venueID'
	    'checkinTime'

	Image fields:
	    'scale_width'
	    'scale_height'

Document API

The document API features three sets of objects: documents, locations, and copies.

	Location fields:
	    'locationID'
	    'name'
	    'address'
	    'phone'
	    'hours'
	    'latitude'
	    'longitude'
	    'accuracy'
	    'locationTime'

	Document fields:
	    'documentID'
	    'published'
	    'url'
	    'title'
	    'description'
	    'price'
	    'price2'
	    'barcode'
	    'imageUrl'
	    'category'
	    'url2'
	    'url3'
	    'documentTime'	

	Copy fields:
	    'copyID'
	    'documentID'
	    'locationID'
	    'copyTime'

	Image fields:
	    'scale_width'
	    'scale_height'

Shopping API

The shopping API features three sets of objects: shops, products, and stock.

	Shop fields:
	    'storeID'
	    'name'
	    'address'
	    'phone'
	    'hours'
	    'latitude'
	    'longitude'
	    'accuracy'
	    'storeTime'

	Product fields:
	    'productID'
	    'published'
	    'url'
	    'title'
	    'description'
	    'price'
	    'priceBeforeSale'
	    'salesCode'
	    'imageUrl'
	    'category'
	    'reserveProductUrl'
	    'checkAvailabilityUrl'
	    'productTime'

	Stock fields:
	    'stockID'
	    'productID'
	    'storeID'
	    'stockTime'

	Image fields:
	    'scale_width'
	    'scale_height'

The output from a successful insert consists of a data file in the same format as the input. For example after using insert to add a person with the social API in XML format, the output will look like:

<?xml version="1.0" encoding="UTF-8"?>
<response>
<results>
<checkinID>2</checkinID>
<personID>0000000001</personID>
<venueID>0000000001</venueID>
</results>
</response>

Exporting data:

Service URL: http://www.nakdreality.com/export?

Data fields for 'export'

startFromIf you are exporting less than 10K records this is optional. Exported data is returned in chunks of records. 'startFrom' indicates the start of a chunk, and defaults to 0. When exporting more than 10K records, make the export API call as many times as necessary, substituting the returned 'finishedAt' value into the next call's 'startFrom' value.
maxRecordsThe maximum number of records to return, which is limited to 10K and defaults to this if not included

The output of an export will look like: (e.g. XML)

<?xml version="1.0" encoding="UTF-8"?>
<response>
<results>
<header>1</header>
<finishedAt>2</finishedAt>
<recordsExported>2</recordsExported>
</results>
<results>
<latitude>51.23456</latitude>
<longitude>-1.23456</longitude>
<title>I woz here</title>
</results>
<results>
<latitude>52.65432</latitude>
<longitude>-1.43210</longitude>
<title>I woz here too</title>
</results>
</response>

The export API service has been designed for clarity rather than efficiency, so please contact us if you have more demanding requirements, and we can make other arrangements

Signing up users:

Service URL: http://www.nakdreality.com/signup?

Data fields for 'signup'

emailThis will be used to validate the user on login. 255 characters maximum length
passwordAny combination of characters, numbers, and punctuation limited to 255 characters
usernameThe nickname or real name of the user. Limited to 255 characters.
captchaIDThe ID field returned from a call to 'captcha'
captchaStringThe user's attempt to match the characters shown on the captcha image
requireCaptchaOptional alternative to the captchaID and captchaString fields, this defaults to 1, but can be set 0 if you are using your own captcha system, or have otherwise verified the user is human/sentient. WARNING: don't make this field available for the public to set, unless you want a robot performing endless junk signups!

The output of a successful signup will look like: (e.g. XML)

<?xml version="1.0" encoding="UTF-8"?>
<response>
<results>
<userID>K1tJikgxGDFoDa9</userID>
<sessionID>ObX9H5HUoGxhcFTRpxsRG1ukCNzMVw6Z</sessionID>
</results>
</response>

The output of an unsuccessful signup could look like: (e.g. XML)

<?xml version="1.0" encoding="UTF-8"?>
<response>
<errors>Your email address has already been taken!</errors>

Possible errors for 'signup'

Your email address has already been taken!
Your nickname has already been taken! Please choose another one.
The Captcha did not match!

User login:

Service URL: http://www.nakdreality.com/login?

Data fields for 'login'

emailThis is the field you must use for the login, and not username
passwordThe user's password should be passed here

The output of a successful login will look like: (e.g. XML)

<?xml version="1.0" encoding="UTF-8"?>
<response>
<results>
<userID>K1tJikgxGDFoDa9</userID>
<sessionID>ObX9H5HUoGxhcFTRpxsRG1ukCNzMVw6Z</sessionID>
</results>
</response>

An unsuccessful login will look like:

<?xml version="1.0" encoding="UTF-8"?>
<response>
<results>
</results>
</response>

Sessions currently expire after 48 hours of inactivity. This value is subject to review.

There is a limit of 10 consecutive unsuccessful logins for a given user before their account is automatically suspended.

Captcha generation service:

Service URL: http://www.nakdreality.com/captcha?

Data fields for 'captcha' when generating a captcha:

[Send no data fields]

New captcha data returned:

IDThe ID of the captcha
urlThe image URL of the captcha
widthThe captcha image width in pixels
heightThe captcha image height in pixels

Data fields for 'captcha' when matching a captcha

IDThe ID field returned when generating the captcha
matchStringThe user's typed text that should match the captcha

Data fields returned when matching a captcha

IDThe ID field returned when generating the captcha
matchResult1 for a match, and 0 for a failure

User data service:

Service URL: http://www.nakdreality.com/user?

Gets or sets flexible field/value data associated with a particular user:

  • If you include a 'value' it will do a 'set'.
  • If you do not include a 'value' it will do a 'get'.
  • If you include no 'field' or 'value' then it will 'get' all fields and values.

Data fields for 'user'

userIDThe userID returned at signup
sessionIDThe sessionID returned at the last login or at signup. This is not necessary to access publicly accessible data for a particular userID
requireSessionOptional alternative to the sessionID, this defaults to 1, but can be set 0 if you do not need a session, e.g. to make a non-user activated change. WARNING: don't make this field available for the public to set, or the public could modify other users' data!
fieldYou can pick any field names you like that match the particular user-data you want to store for each user (up to 50 characters long)
publicIf this is 1 then: a set will make the field/value pair publicly accessible; and a get will look-up only publicly accessible data. Leave empty to default to private data on set or get.
valueYou can pick any values up to 255 characters long

Data fields returned from 'user' gets

valueThe value of the field passed in

Possible errors for 'user'

Session invalid or expired!
No 'username' or 'userID' included!
No 'field' included!
No 'sessionID' included!(only if a session is required for private data)
Unrecognised user!

Authentication service

Service URL: http://www.nakdreality.com/authenticate?

Authenicates a user's session, based on their userID and sessionID (as previously returned from the 'login' or 'signup' service).

Data fields for 'authenticate'

userIDThe userID returned at signup
sessionIDThe sessionID returned at the last login or at signup.
getUsernameOptional field. Set 1 to get the username at the same time as authenticating

Data fields returned from 'authenticate'

authenticatedA 1 or 0 indicating whether the user and session authenticated, or failed to authenticate, respectively
usernameIf 'getUsername' was set to 1 in the API call, we will return the username here if the user's session authenticated



"NakdReality's understanding of the geo-marketing arena...is second-to-none."    Corke Wallis Ltd.