1

I'm working my way through the MVC 4 Beta along with the SPA options. I get the idea of adding service endpoints to the project and then using Upshot to connect to them. However, the application I want to build will communicate with an external web service. In other words I cannot point Upshot at a local controller to get metadata information because it won't have it. Instead I would point it at a REST service endpoint.

Does anyone have an example of or reference information on hooking up the Upshot remote data source to a true remote data source? I'm looking for a full example unlike one of the other previously asked questions. I just can't seem to wrap my head around it yet.

Thanks

Brent Pabst
  • 1,156
  • 1
  • 15
  • 37

2 Answers2

1

I did play a lot with Upshot and its RemoteDataSource object and I can assure you that it's a helper library on top of OData services. If you read my post on filtering and sorting data, you can see the OData conventions just leaking through.

http://bartjolling.blogspot.com/2012/04/building-single-page-apps-with-aspnet.html

Just skip the first one-third of the post until you get to the interesting part about the GET request that is generated by Upshot. If you browse the upshot.js code, you will see that the 'get' function uses a Ajax GET request and that the 'submit' function uses an Ajax POST request. An 'operation' property indicates if it's an insert, update or delete operation.

If you want REST, then Upshot is not for you. For more information, see this question on the ASP.NET forums: http://forums.asp.net/t/1776372.aspx/1?SPA+and+REST

Bart Jolling
  • 595
  • 6
  • 21
  • I can see why you say this. Obviously it allows for OData input but you don't have to add any OData parameters and then it becomes a simple REST call. Heck you can even add POST, PUT and DELETE in UpShot, Steven Sanderson showed this in his Delivery Tracker sample app. My only point is that it's able to make all of these calls but it can't seem to do it without specifying the the model, which was my original question. I essentially want to build the Delivery Tracker app with a remote Web API, any ideas on how to accomplish that? – Brent Pabst Apr 05 '12 at 14:12
  • I have been spending the last month dissecting, recreating and improving Steven's DeliveryTracker application on my blog. I honestly don't know where you've seen REST support in upshot.js because according to my experience it isn't in there. I've updated my answer above with the results of some further research I did in the upshot.js source code... I suppose that you can always edit the upshot.js file youself and add it in. It shouldn't be to hard but you will lose the benefit of upshots batched 'changeset' feature – Bart Jolling Apr 05 '12 at 20:11
  • I just realized the correct answer to the question in your comment. WebApi indeed supports REST but you cannot use upshot.js to communicate with a RESTful service. You will need to find a different javascript library that DOES know how to communicate to a RESTful service – Bart Jolling Apr 05 '12 at 20:19
0

I haven't touched too much of upshot.js but my understanding is that most of the functionality is for ODAta-providers. There's a upshot HTML helper which you'll see in SPA which provide meta-data.

If you have a REST (non-OData) interface i'm not sure if upshotcan help you.

Mixitrixi
  • 157
  • 1
  • 10
  • This doesn't sound right. As a matter of fact the BigShelf example application has a special case just for OData feeds aside from the normal implementation. So I don't think this is right. – Brent Pabst Apr 01 '12 at 15:26