Orchard and WebAPI

Topics: Core, Customizing Orchard, Writing modules
Sep 20, 2012 at 6:29 AM

Baes on the tutorial of Sebastien Ros about Orchard and WebAPI at http://www.sebastienros.com/web-api-makes-it-in-orchard, I must say that it looks very promising and that I am thinking about basing one of my products on Orchard with WebAPI.  I have also read that the focus for version 1.6 is a lot about MVC 4 and WebAPI.

My question therefor is: can I start off with version 1.5.1, or would it be better to wait for 1.6?  I would require to be able to inject my own controller configurations with formatters, action value binders and all that yummy stuff :)

Also, if your advise would be to wait for 1.6, would it be possible to function as some form of early bird and get the bits a bit sooner, even though its in a pre-beta stage or whatever?

Thanks in advance,

Andy

Sep 20, 2012 at 10:41 AM

 I did try tutorial of Sebastien Ros about Orchard and WebAPI (in Orchard 1.5.1) and could not make it. And finally I setup a WCF service.

Actually I'd like to know the answer too.

Developer
Sep 20, 2012 at 11:04 AM

You quickly turned to WCF. That's a shame, as WCF is the dark side of MS web services :-).

Web API support will come with 1.6. If you can't wait, just clone the Orchard repo and update it to the 1.x branch. It's reasonably stable, but still a work in progress.

Sep 20, 2012 at 1:18 PM
Edited Sep 20, 2012 at 1:19 PM

Being in the dark side is better than sitting and waiting.. :-) However I appreciate your amazing work of art in orchard..

Is there any estimate for release time of 1.6...

Besides I don't know if you could look at my another questions in http://orchard.codeplex.com/discussions/396156..

Thanks in advance..

Developer
Sep 20, 2012 at 1:41 PM

Thank that piece of art the countless developers and contributors :-). 1.6 will be release when all of the open issues (for that release) are fixed and/or closed. There are many such issues, but it's still a rational target. I can't give you an estimate though, depends also on the contributions.

Coordinator
Sep 21, 2012 at 8:53 PM

And as has been said, you can clone to the 1.x branch today and get the code.

Sep 21, 2012 at 9:08 PM

Thank you guys...

Oct 4, 2012 at 10:48 AM

Hi there,

Just a quick question: what we can do (briefly) with orchard WEB API, can we create page, delete page, create content type and add content part via WEB API?

and another question that i have is that: as i can see when i create a page, the URL is: http://mysite.com/Admin/Contents/Create/Page, i was trying to create an custom admin page posting same data to that URL but it doesn't seems to work (i have already turned off anti-forgery)...

Is there any clue to create such custom admin page?

thanks in advance.

Jerry

Developer
Oct 4, 2012 at 10:54 AM
jerry_hokh wrote:

Just a quick question: what we can do (briefly) with orchard WEB API, can we create page, delete page, create content type and add content part via WEB API?

 


Absolutely. Just inject ContentManager and ContentDefinitionManager into your ApiController implementation and go wild.

Developer
Oct 4, 2012 at 10:56 AM
jerry_hokh wrote:

and another question that i have is that: as i can see when i create a page, the URL is: http://mysite.com/Admin/Contents/Create/Page, i was trying to create an custom admin page posting same data to that URL but it doesn't seems to work (i have already turned off anti-forgery)...

Is there any clue to create such custom admin page?

I don't fully understand your question. Could you elaborate on what exactly isn't working? What are you trying to do exactly. Are you seeing errors?

Oct 4, 2012 at 11:06 AM

ah, im trying to create page dynamically from source code, so i try make a aspx page to use that URL to create page but it doesnt work, it might be a wrong direction.

regarding to your answer above about ApiController, is it something that i have to write myself or provided by Orchard to create web service?

do you have any sample code on create a page dynamically?

Thanks a lot for your answers

 

Developer
Oct 6, 2012 at 4:54 AM
Edited Oct 6, 2012 at 4:54 AM

It's hard to tell if it's the right direction or not as I don't know your requirements. However, I can totally see an Orchard module exposing an API in the form of an Web API and use it from another application (I'm guessing web forms in your case).

You say that it doesn't work - are you seeing an errors?

To learn more about creating your own ApiController, read this: http://www.sebastienros.com/web-api-makes-it-in-orchard