users@glassfish.java.net

How to format POSTS to Restful with JSON?

From: <glassfish_at_javadesktop.org>
Date: Fri, 16 Jan 2009 05:55:26 PST

Hello,

I'm trying to implement some RESTful web services to pass info between an iPhone and a remote database. I've managed to obtain data from the server and load it into the iPhone but have been unable to pass data from the iPhone to the server.

I think that the problem is that I really don't understand the format that the RESTful services expect to see on a POST command. I've generated RESTful services using the Jersey plugin in Netbeans. I don't really know where I need a field such as a URL and when it's optional.

I've been experimenting with the Test RESTful web services in Firefox. Here's an example of a string that I'm trying to write to the database:

{
                        "accuracy":"100",
                        "pk":"10",
                        "time":"2001-10-15T01:00:00-05:00",
"peopleCollection":{"@uri":"http://localhost:8080/HereIAmDB/resources/peoples/emarsh/peopleCollection/",
"people":[{"@uri":"http://localhost:8080/HereIAmDB/resources/peoples/janetch/"}]
                }}

I'd replaced the pk lookup with userid which is where the emarsh and janetch came from.

Can anyone point me at some reference material that will help me sort this out?

Thanks,

Eric
[Message sent by forum member 'eric_marsh' (eric_marsh)]

http://forums.java.net/jive/thread.jspa?messageID=326463