rest

Code for syncing the iPhone with REST-servers

Hey, is there any open source code for syncing an iPhone with a server (preferably REST)? Found nothing on github and google code. Regards... ...

Set Content-Type for testing from Firefox

I need to do some REST service testing from Firefox where I set the Content-Type HTTP header to a specific value (to retrieve XML or JSON). Is there a Firefox add-on that can do this? ...

How to add xsl stylesheet node to XML produced by XmlSerializer?

I have an WCF REST service which returns objects serialized with XmlSerializer. How can I add XSL stylesheet information (like the one below) to the output returned by the WCF service? <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="transforms/Customer.xsl"?> <Customer> <Name>Foo</Name> </Customer> My...

How to consume JSON formatting with ruby's ActiveResource?

ActiveRecord introduced a change to its default JSON output format. It went from { "user": { some_junk } } to { some_junk } ActiveResource has apparently followed their lead, expecting to consume JSON as { some_junk } I am trying desperately to consume a RESTful web service which emits { "user": { some_junk } } Is there a w...

Zend Framework routes with ajax friendly parameters

I'm building a REST API with Zend Framework. I have routes setup that are mapped to all the resources I modeled. I also created a RESTful controller plugin to direct the different types of requests (PUT, GET, etc..) to the right controller action. I'm making ajax calls with jQuery and by default it appends GET parameters to the URL for ...

How do you deal with dynamic resources in a RESTful context?

From what I understand of REST principles, URLs should represent a single resource, like a user or a product. How do you deal with resources that are random, or generated dynamically? Suppose I create a resource called api.example.com/integer that returns a random integer. Would I still use GET to retrieve the integer? What would POST, ...

REST Client for Ruby Gives ActionController::InvalidAuthenticityToken

I have a RESTful Rails application with a resource called "Foo". I'm trying to use REST Client to do a put: resource = RestClient::Resource.new 'http://localhost:3000/foos/1', :user => 'me', :password => 'secret' resource.put :name => 'somethingwitty', :content_type => 'application/xml' But my app raises: ActionController::InvalidAut...

How do I catch HTTP errors when using WCF's WebGet attribute?

I'm using the [WebGet] attribute to query a REST API on a web server. Every so often (because the API is still under development) I get back an HTML document in the form of an HTTP/500 error instead of the XML I want. Here's an example of my operation contract: [WebGet(UriTemplate = "search/?api_key={key}&query={query}", BodyStyle =...

Is REST suitable for large 3NF models

There are many examples of using REST with simple data models. For example a customer with 5 properties and a collection of orders with 6 properties. However I have a hard time visualizing using REST against a model that is more complex -- that you may find in government procurement, finance, medical records management etc. Are there ...

WSDL vs REST Pros and Cons

Related: Why would one use REST instead of Web services? When deciding whether to implement a web service using SOAP or REST (by which I mean HTTP/XML in a RESTful manner) what should I be aware of and what should I be thinking of? I presume that this isn't a one size fits all thing so how do I choose which to use. Regards ...

Rails, ActiveResource, and Pagination

What's the best way to implement pagination in a REST API so that an ActiveResource client can easily navigate paginated results? There have been some proposals, for example here and here, but being new to ActiveResource I'm wondering if there's a better way. ...

REST - supporting multiple possible identifiers

For the site I am working on, we are in the process of improving our URLs for one type of resource - specifically, moving away from numerical IDs toward unique, descriptive strings. A similar example would be switching from identifying users by numerical database ID to identifying them by username (not our specific case, but analagous). ...

Simple, secure API authentication system.

I have a simple REST JSON API for other websites/apps to access some of my website's database (through a PHP gateway). Basically the service works like this: call example.com/fruit/orange, server returns JSON information about the orange. Here is the problem: I only want websites I permit to access this service. With a simple API key sys...

RESTful HTTP response codes

I'm developing a simple RESTful API, and utterly in love with how minimalistic it is. But I'm uncertain as to the correct HTTP response codes for various situations: Incorrectly formed query Correctly formed query refers to a resource which does not exist Resource successfully deleted Resource successfully edited I'm currently thinki...

Should I RESTify my RPC calls over HTTP?

We have HTTP webservices that are RPC. They return XML representing the object the either retrieved or created. I want to know the advantages (if any) of "restifying" the services. POST http://www.example.com/createDoodad GET http://www.example.com/getDoodad?id=13 GET http://www.example.com/getWidget?id1=11&amp;id2=45 POST http://ww...

How to define endpoint without web.config or httpModule?

I would like to make a RESTful app of HTTPhandlers without having to define every endpoint by making an entry in the web.config, i'd like the style of attaching attributes to a class constructor eg: public class obj : IHttpHandler { [WebGet(UriTemplate = "/accounts/{id}")] public obj(string id) { // this is just an eg, it wor...

What is the scariest LINQ function you've seen?

While working on a personal project I wanted a simple service to extract items out of Outlook and host in WCF in a "RESTful" design. In the process I came up with this rather beastly class. What other scary linq code have people have seen? public IQueryable<_AppointmentItem> GetAppointments(DateTime date) { var dayFlag = (OlDaysOf...

What is the best way to implement REST based Web Services in .NET?

So far my options are ADO.Net data services, WCF REST Starter Kit(not sure if I can use it, as their EULA is hard to comprehend and confusing), ASP.NET MVC. There are quite a few posts, but I want to see if there are anymore frameworks that I am missing. Also please post your experiences if you already used any of the above options. Th...

How do I know when to and whether to have a separate controller for a piece of code?

So I am in a situation where I have to decide whether or not to have a separate controller for a particular piece of code. We have a home page that acts like a hub for the rest of the site. The page is accessible to all users (logged in as well as non-logged-in). I was thinking about having home as a separate controller and an action cal...

RESTful service operations for querying data

When defining a resource orientated RESTful service do you think it's a good idea to define an explicit operation (verb) for querying data? It seems obvious and easy to map CRUD operations on a resource orientated RESTful service using HTTP to operations such as PUT, GET, POST & DELETE but how should operations that query for multiple r...