rest

Posted XML attributes dropped by Rails?

echo '<request><item attribute="foo">bar</item></request>' | curl -X POST -H 'Content-type: application/xml' -d @- http://10.0.1.51:3000/baz/evaluate My Rails application forgets all about the attribute when it receives the posted XML. Processing BazController#evaluate (for 10.0.1.3 at 2009-10-03 18:29:32) [POST] Parameters: {"reque...

Sorting page flow for has_many in Rails

I have a page flow allowing the user to choose an object ("Player") to add to a has_many :players association in another model. 1 => List existing players for object [Enter player name] 2 => List of matching players [Select player] 3 => Confirmation page [Press 'Add'] 4 => Done I want users to be able to choose "New Player" inst...

Optimizing a RESTful Query in the client...

READ FIRST before answering! I have a RESTful service which wraps around the Entity Framework. Basically, all I did was create a database, add relations between the tables, create an Entity model around this database and finally expose the whole thing as a RESTful *.svc service. This is done, cannot be changed either. Now I need to que...

Django - Parse XML, output as HTML fragments for iFrame?

heya, I've been asked to quickly put together a small system that takes a Yahoo XML feed, parses it, and creates a HTML fragment based on it. At the moment, I'm using Django to handle the URL routing, with some Python script, and outputting a bit of HTML in a (with hardcoded dimensions as inline CSS), that can hopefully be put into an...

Calling Rails update Method via Inline Edit

I was putting together a quick inline editing feature in my first Rails app and just as I was getting it working it occurred to me that I may be violating RESTful principles. The edit updated an image name. To do so, it submits, via PUT to Image#update and passes the new modified name as image[name]. The database gets updated properly,...

Solutions to web service client certificates/auth best practices

I have a simple web service that has an API third party developers are allowed to access. The API mostly follows REST principles. I'm interested in solutions to make the API more secure by requiring developers to use client certificates. Is there any open source solutions or other implementation advice any of you have that would assist ...

Are there any disadvantages of building a .NET REST client using HttpWebRequest/Response

Hi, I want to build a .NET REST client using C#, and although i read lots of posts here about the common practices regarding REST, i could not make sure about something. I've read lots of REST client examples and most of them were using just HttpWebRequest/Response classes to make the requests and receive the responses. What i want to a...

PUT/POST not working in self-hosted WCF REST configuration

Greetings! I have a self-hosted server (Windows service) that is supporting both SOAP/RPC (this may go away in the future) and REST. The RESTful GETs are working as expected, but PUT/POST are giving a 405 error (Method Not Supported). I'm pretty sure this is a configuration issue with my app.config, but I'm pretty new to this and am not...

MVVM, REST and AsyncModels

Hi! I feel, that MVVM and REST being considered together can produce a solid and reliable pattern for programming for many years. (My intuition says me that we SHOULD consider them together). Also it seems that it should be a proper abstraction for Asynchronous operations in ViewModels and Controllers - like a composable asynchronous dat...

YFrog API no longer supports public/private option?

I'm tring to use YFrog's API to upload a picture. The documentation is as follows http://yfrog.com/api/upload Use this method if you only want to upload a photo or video to yfrog. Request fields (post data should be formatted as multipart/form-data) media - Binary image or video data; either media or url para...

RESTful API response status code disambiguation

I'm developing a RESTful API and have a question about the most appropriate response status codes for certain scenarios. Consider the case where the client makes a GET request for a resource. How can I disambiguate a "not found" response for the case where the resource legitimately does not exist, vs. the case where there may be a minor...

Is it a good thing for a custom rest protocol to be binary based instead of text based like Http?

Have you ever seen a good reason to create a custom binary rest protocol instead of using the basic http rest implementation? I am currently working on a service oriented architecture framework in .Net responsible for hosting and consuming services. I don't want to be based on an existing framework like Remoting or WCF, because I want t...

POSTing to different action with Zend_Form (and validation)

I'm using Zend Framework, and am curious about how people handle form submission. Right now, I'm using something like this: public function editAction() { $form = my_form(); $this->view->form = $form; if ($this->getRequest()->isPost() { $params = $this->getRequest()->getPost(); if ($form->isValid($params) {...

REST standard for GET on a resource that doesn't exist

The resource /user/12345 doesn't exist. Lets say the consumer is trying different ids randomly. There is no authorization. Any user can view any user. In a broader sense, my question is "What should you return if you do a GET on a resource that doesn't exist?" Should I return an empty user for an id that doesn't exist or should I return...

RESTful design - how to model entity's attachments

I am trying to model entity's attachments in REST. Let's say a defect entity can have multiple attachments attached to it. Every attachment has a description and some other properties (last modified, file size...) . The attachment itself is a file in any format (jpeg, doc ...) I was wondering how should I model it RESTfully I thought a...

What should the standard be for ReSTful URLS?

Since I can't find a chuffing job, I've been reading up on ReST and creating web services. The way I've interpreted it, the future is all about creating a web service for all your data before you build the web app. Which seems like a good idea. However, there seems to be a lot of contradictory thoughts on what the best scheme is for ReS...

XML POST REST Request using Python

Does anyone have a simple example of sending an XML POST request to a RESTful API with Python? I am trying to use the urllib2 Python library to "create a new project" in the Harvest API, with no luck. The payload variable is a valid XML document that is a near copy/paste of their documentation (under the Create New Project heading) sho...

Getting real with REST

I browser around for a decent example of a simple, fully REST API, to no avail. Checked on stackoverflow as well. The best I've seen is this post. Despite this, I still don't get the point. Let's take an example of an application that we all know: wikipedia. Suppose we want to create a REST API for wikipedia. We expect the following ver...

What are possible RESTful service request formats accepted from the client

Hi, I am writing a thesis and currently desccribing the implemented methods and services. In the book RESTful Web Services (O'Reilly) I noticed there are the following possible request formats: JSON, XML, made-up vocabulary and Atom. I created a service using WCF. Below is one of the methods declared in the interface: [OperationC...

Multiple services on same JBoss server?

We're developing a few new services that will run on JBoss and will be accessible by REST API-s. These will be Java apps bundled into EAR files. Is it a good practice to deploy these services to the same JBoss server? This would simplify dev, deployment and testing. Not sure if there are any big drawbacks. Would there be limited...