×

Discussion Board

Results 1 to 6 of 6

Thread: Rest API

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    21

    Rest API

    hi,
    I already worked with the Rest API for about one month and all worked fine. BUT now I don`t remember which steps I did that it worked I don´t get it to run anymore!

    I only have to call
    http://<domain_name>/rest/presence/availability to receive the appropriate xml data for instance, right? or do I have to install/store something in the htdocs folder that this call works?

    thx for reply!
    best regards,
    Askin

  2. #2
    Nokia Developer Expert
    Join Date
    Sep 2007
    Posts
    60

    Re: Rest API

    Quote Originally Posted by _Askin_ View Post
    hi,
    I already worked with the Rest API for about one month and all worked fine. BUT now I don`t remember which steps I did that it worked I don´t get it to run anymore!

    I only have to call
    http://<domain_name>/rest/presence/availability to receive the appropriate xml data for instance, right? or do I have to install/store something in the htdocs folder that this call works?

    thx for reply!
    best regards,
    Askin
    No, if you have MWS 1.3 (not PAMP or Raccoon) it will just work.

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    21

    Re: Rest API

    hmm...strange! I use MWS 1.3. After calling http://<domain_name>/rest/presence/availability in the browser i get:

    Not Found
    The requested URL /rest/presence/availability was not found on this server.

    any idea/suggestion?
    Last edited by _Askin_; 2008-05-27 at 11:36.

  4. #4
    Nokia Developer Expert
    Join Date
    Sep 2007
    Posts
    60

    Re: Rest API

    Quote Originally Posted by _Askin_ View Post
    hmm...strange! I use MWS 1.3. After calling http://<domain_name>/rest/presence/availability in the browser i get:

    Not Found
    The requested URL /rest/presence/availability was not found on this server.

    any idea/suggestion?
    If you don't have access, it will return Not found (which is an error of course). Either allow access for anonymous or submit correct credentials.

    http://wiki.forum.nokia.com/index.ph...eb_Server_APIs.

  5. #5
    Registered User
    Join Date
    Feb 2008
    Posts
    21

    Re: Rest API

    omg...all clear now, it was my fault, sry! deleting the rest folder is not good

    thx for reply
    Askin

  6. #6
    Registered User
    Join Date
    Aug 2008
    Posts
    31

    Re: Rest API

    is it or how is it possible to use the REST API inside a python script, which is running on the MWS?

    I tried a simple sample but i have an error with import xml.sax, the error is "no module name xml.sax" i think its because i need pyexpat from pyxml but i don´t find it on the web.

    Is there another way to do this sample whitout the module xml.sax?

    Code:
    import appuifw
    import e32
    import urllib
    import xml.sax
    import xml.sax.handler
    
    
    
    class DeviceStateHandler(xml.sax.handler.ContentHandler):
    	
    	def __init__(self, device):
    		self.device = device
    	
    	
    	def startElement(self, name, attributes):
    		if name == "devicestate":
    			self.device = DeviceState(attributes["battery_level"],attributes["localtime"], attributes["connection_type"])
    			
    
    
    
    class DeviceState:
    	
    	def __init__(self, battery_level, localtime, connection_type):
    		self.battery_level = battery_level
    		self.localtime = localtime
    		self.connection_type = connection_type
    	
    	
    	def getAttributes(self):
    		return u'Battery Level: ' + self.battery_level + u'\nLocalTime: ' + self.localtime + u'\nConnection Type: ' + self.connection_type
    
    
    
    def quit():
    	appuifw.app.set_exit() 
    
    
    
    appuifw.app.exit_key_handler = quit
    
    
    
    def imprimir(texto):
    		appuifw.note(texto, 'info')
    
    
    
    def stateDevice():
    	url = "http://127.0.0.1/rest/presence/devicestate"
    	content = urllib.urlopen(url).read()
    	
    	handler = DeviceStateHandler()
    	xml.sax.parseString(content, handler)
    	
    	imprimir(handler.device.getAttributes())
    
    
    
    appuifw.app.menu = [(u'State', stateDevice)]
    
    
    
    appuifw.app.title = u'Sample REST Services'
    
    
    
    app_lock = e32.Ao_lock() 
    
    
    
    app_lock.wait()

Similar Threads

  1. PC Suite error: (Code: Init IMediaControl2) HELP?!
    By chunkyspudmonkey in forum General Development Questions
    Replies: 30
    Last Post: 2014-07-15, 05:44
  2. Answer incoming call silently
    By tote_b5 in forum Symbian Networking & Messaging (Closed)
    Replies: 33
    Last Post: 2011-05-25, 11:39
  3. S60 API Partnering Program
    By Nokia Ron in forum News and Announcements
    Replies: 9
    Last Post: 2008-04-16, 18:28
  4. FPC Bench, Database API and a lot more...
    By sblantipodi in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2008-03-23, 01:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×