rest

RESTful media types for audio/music collection service (with metadata)

I have a large music collection, composed of mp3 files, flac files, and others. I would like to share it with devices on my local network and computers I am using on remote networks. It seems to me that HTTP is eminently well-suited to the sharing of files and I wonder if there's anything saner than uPNP (a.k.a DLNA) that my server cou...

Rails: what is wrong with this route?

For some strange reason cardsets_path('my') generates "/cardsets.my" instead of "/cardsets/my". Please explain why? config/routes.rb: match '/cardsets/:type', :to => 'cardsets#index', :requirements => { :type => /my|public/ }, :as => 'cardsets' resources :users do resources :cardsets do end end rake routes: cardsets /cardsets/:...

how can I get URI of currently dispatched web resource, in JAX-RS?

How can I get a full URI of the resource currently dispatched in JAX-RS? I'm trying to return a URI of newly created object, and need a prefix part of it, with host, port, etc.: // @import-s skipped public class Factory { @POST public final Response create() { Integer id; // new object created and id is set return Respon...

Spring MVC: Correct Annotation of Controller Method for RESTful URI including ';'

Designing my RESTful API, I would like use following URI http://[HOST]/[PLANET]/[LAT];[LONG] e.g. http://myserver/earth/50.2;29.1 What is the appropiate annotation of a such a method in Spring MVC? Is this the following one ok? @RequestMapping(value = "/{planet}/{lat};{long}", method = RequestMethod.GET) public String showInfoAbou...

When hosting a WCF REST service in a console app, error finding contract name

I have a WCF REST service that works from a Windows service (.NET 3.5). To make it easier to build and debug, I would like to run it from a console. When I do this, I am setting up the endpoints in the console app. When I create an endpoint, it fails with this error: "The contract name 'IRestService' could not be found in the list of ...

How to enable timeout per each restful web service method

How would one go about setting timeouts for each REST API method on the server side. For example I have certain web service methods that upload images and I want to increase the timeouts for these methods compared to ones that have lower http payloads. Architecture I am dealing with: haproxy, nginx, tomcat ...

How do I use rails route helpers with jQuery?

I would like to use the jQuery ajax method $.get to access a restful route in rails. Something like this (keep in mind this is done in a haml template where I can use string interpolation): $(function(){ $(':radio').change(function(){ $.get("#{edit_steps_path(N)}"); } }); In the snippet above #{steps_path(N)} interpolates to...

Avoid serializing certain properties in REST services

I have a .Net application split in client and server sides, and the server provides REST services (using WCF). I have services definitions like these: [WebGet(UriTemplate = "/Customers/{id}")] Customer GetCustomerById(string id); [WebGet(UriTemplate = "/Customers")] List<Customer> GetAllCustomers(); The Customer class and its friend...

Design approach: android and web service

I am developing an app for android mobiles that communicates with a json/rest web service. I need to make certain kinds of calls periodically to the server to check for some information. Within that context I might need also to query the GPS for the current position. I'm quite undecided to use a Local Service, since I don't know very wel...

Using blocking REST requests to implement publish/subscribe

I've recently been asked to investigate the feasibility of integrating with a phone system vendor who wants to make phone events (e.g. line ringing, extension answered, call cleared) available using a RESTful web service. I pointed out that REST is a request/response protocol and they were doing publish/subscribe. The solution they were...

Moving to a New Stack - AJAX, REST & NoSQL

All, I'm beginning to explore what frameworks (open source) and tools for building web applications. What should I select and learn for the following layers, Layer 1 Client side JavaScript / AJAX library or framework that will invoke REST style services provided by layer- 2 Layer 2 Provides a framework to rapidly create REST style serv...

WCF REST: ReadAsDataContract with Twitter Client (Aaron Skonnard)?

Hi there, I am looking for some help with ReadAsDataContract in WCF REST. I found screencast and walthrough from Aaron Skonnard which shows how to ReadAsDataContract. For some reason I can't seem to find it again. I have found 1 screencast from him but it only shows info about ReadAsXML etc Is anybody aware of this screencast and wher...

ASP.NET MVC - How to Create a RESTful Controller Scheme?

Hi Guys, If this is a duplicate, please let me know - because i had a quick look and couldn't find anything that really answers my question. I'm experimenting with ASP.NET MVC 2. Now coming from a Web Forms background, i only really dealt with HTTP GET and HTTP POST. I'm trying to see how i could apply GET/PUT/POST/DELETE to the respe...

Get values of HttpClient TransportSettings.Credentials in WCF REST 4.0

I have a client wherein I pass in the username, password through network credentials. What I want to do is to pass these two parameters to the service itself for authentication purposes: Example shown below: Client: HttpClient client = new HttpClient("http://localhost:8080/ProductService/"); client.TransportSettings.Credentials = ...

Modeling resource relationships with RESTful APIs

When designing a RESTful API should resources which are dependent on others be modeled as sub-uris or should they simply reference each other? E.g. presuming a door is always dependent on a house then /house/73/door/1 or /house/73 /door/1044 where house and door include references to each other? Most RESTful APIs I have found are...

RESTful Web Development With Java EE 6 - what are the options?

I'm trying to figure out what the best options are for developing a RESTful web application with Java EE 6. For example, I want to be able to interpret a URL like so: GET www.myapp.com/customers/1 - returns a web page displaying details about a customer with id 1. The only two options I can think of are Using Spring MVC 3 Using a JAX...

good practise: REST API as the interface between the interface layer and business layer?

I was thinking about the architecture of a web application that I am planning on building and I found myself thinking a lot about a core part of the application. Since I will want to create, for example, an android application to access it, I was already thinking about having an API. Given the fact that I will want to have an external A...

Google translate in-app, is it possible?

Is it possible to translate a webpage within a webuiview using google translate? I am aware that you can use their rest services to translate some text, but I have not found any way to translate a web page. You can do some trick with the url but that adds along with the translate page a banner at the top that I don't need. ...

How should a WCF service implementation handle errors/faults without coupling to FaultContract

I understand the concept of Fault Contracts in WCF, but they seem to be tightly coupled to WCF and SOAP in particular. I've created a set of services that are separate from the contract definitions and the implementations could be used in many ways, not just WCF/SOAP. For instance, if I wanted to create a RESTful service, or just use t...

jersey webservice returns a 415 when executing a PUT from Ext.Ajax.request

Hey all, So, I've got a pretty simple RESTful jersey webservice, and I'm wanting to call it from my javascript code. I have no problem executing a GET request, but for some reason, when I execute a PUT, I get back a "415 Unsupported Media Type" error. Any idea what I'm doing wrong? Here's my webservice : package servlet; import jav...