NeoMap Webservices » History » Version 93

« Previous - Version 93/95 (diff) - Next » - Current version
Stefan Keller, 05/22/2013 05:07 PM


NeoMap Client API

See also Other Webservices (GetGeonamesAndPOIs).

Current State

Current API Version: v1

  • 22.05.2013
    • Update API documentation (authentication logic)
  • 09.01.2012
    The Neomap Server and API v1 are now available here: http://neomap.hsr.ch
  • 19.12.2011
    • Changed NeoMap Model to appropriate field names.
The following attribute names have changed:
Before After
mapName name
mapDescription description
mapKMLFile map_file
fileSize file_size
boundingBox bbox
isPublic is_public
uploadDate created
mapOwner map_owner
  • Detailed Schema (as soon as deployed) available under: api/v1/neomap/schema/
  • 13.12.2011
    • API Tests Complete
    • Updated API Documentation to match latest API Version
    • Started Implementing Server API Tests
  • 12.12.2011
    • API Unit Tests
    • Some improvements in authentication and authorization code.
  • 06.12.2011
    • Added file size attribute to neomap data model.
  • 02.12.2011
    • User resource is now embedded in neomap resource. Changed example JSON below accordingly.

NeoMap Web Service API

  • The current API release only allows GET (read) requests. Modifying request are not implemented and allowed.
  • To get a list or view private maps the respective services require user authentication. For further information on user authentication see Authentication API below.

NeoMap News

URL /api/[version]/news
Parameters last_message_id
Method GET
Returns 200 OK Message found. Ok.
Description This service takes the URL parameter
last_message_id
and returns all messages up to latest news as a JSON array. In case there are no new messages the response array is empty.

JSON Response Success:

{
  Multiline-Text ASCI
}

Get NeoMap List

URL /api/[version]/neomap/
Parameters - (username/password in body/data (optional); see also Authentication API below)
Method GET
Returns 200 OK
Description Returns a list of NeoMaps. This should always return successfully. In case there are no maps, the objects array will be empty. In case user authentication is successful, also private maps are included.

JSON Response - Example

{
   "meta":{
      "limit":20,
      "next":null,
      "offset":0,
      "previous":null,
      "total_count":3
   },
   "objects":[
      {
         "boundingBox":"[8.881094801, 47.21610605, 8.93084507, 47.23639643]",
         "fileSize":1120938,
         "id":"1",
         "isPublic":true,
         "mapDescription":"Die Karte liegt etwas schief in der Gegend.",
         "mapKMLFile":"http://localhost:8000/media/maps/Chlosterwald_2003_8.kmz",
         "mapName":"Chlosterwald",
         "resource_uri":"/api/v1/neomap/1/",
         "uploadDate":"2011-12-09T09:51:00.173598",
         "user":{
            "resource_uri":"/api/v1/user/3/",
            "username":"Testuser" 
         }
      },
      {
         "boundingBox":"[8.881645868, 47.21749619, 8.901420474, 47.22869554]",
         "fileSize":715585,
         "id":"2",
         "isPublic":true,
         "mapDescription":"\u00f6ffentliche Karte von Oberwald",
         "mapKMLFile":"http://localhost:8000/media/maps/Oberwald_19.kmz",
         "mapName":"Oberwald Karte Testuser",
         "resource_uri":"/api/v1/neomap/2/",
         "uploadDate":"2011-12-09T09:52:07.330575",
         "user":{
            "resource_uri":"/api/v1/user/3/",
            "username":"Testuser" 
         }
      },
      {
         "boundingBox":"[8.881645868, 47.21749619, 8.901420474, 47.22869554]",
         "fileSize":715585,
         "id":"4",
         "isPublic":true,
         "mapDescription":"Oberwald Karte",
         "mapKMLFile":"http://localhost:8000/media/maps/Oberwald_21.kmz",
         "mapName":"\u00d6ffentliche Karte user",
         "resource_uri":"/api/v1/neomap/4/",
         "uploadDate":"2011-12-09T09:54:44.240337",
         "user":{
            "resource_uri":"/api/v1/user/2/",
            "username":"user" 
         }
      }
   ]
}

Get NeoMap

URL /api/[version]/neomap/[id]/
Parameters - (username/password in body/data (optional); see also Authentication API below)
Method GET
Returns 200 OK All ok.
401 Unauthorized In case the map with [id] is private and the requesting user is not the map owner.
400 Bad Request In case no map with [id] exists.
Description Returns a specific NeoMaps identfied by [id]

Response - JSON-Example

{
   "boundingBox":"[8.881645868, 47.21749619, 8.901420474, 47.22869554]",
   "fileSize":715585,
   "id":"2",
   "isPublic":true,
   "mapDescription":"\u00f6ffentliche Karte von Oberwald",
   "mapKMLFile":"http://localhost:8000/media/maps/Oberwald_19.kmz",
   "mapName":"Oberwald Karte Testuser",
   "resource_uri":"/api/v1/neomap/2/",
   "uploadDate":"2011-12-09T09:52:07.330575",
   "user":{
      "resource_uri":"/api/v1/user/3/",
      "username":"Testuser" 
   }
}

Authentication API

Users managed by NeoMap Webapplication (account required for upload and accessing private maps).
  • Username
  • Password

Login

URL /api/[version]/user/login/
Parameters -
Method POST
Returns 200 OK All ok. Logged in.
401 Unauthorized Either the user provided credentials are wrong or there were no credentials at all.
Also in case the user account is not active.
Description Login the user given in POST data (body). Data should be in JSON format as shown below (no Session id, no basic authentification).
{
   "username":"user",
   "password":"user" 
}

Logout (not implemented nor needed)

URL /api/[version]/user/logout/
Parameters -
Method GET
Returns 200 OK All Ok, also when the user is not logged in.
Description Logout the requesting user. This method does nothing in case the user is not logged in.