Forum

HomeHomeCoreCoreGeneralGeneralCreating a RESTful API with OWSCreating a RESTful API with OWS
Previous
 
Next
New Post
7/7/2015 6:14 AM
 

Hi folks,

I'm playing around with creating a number of APIs in my DNN site. My API's are internal only so I could use whatever method I want but I would experiement using REST as I am curious. 

Has anyone out there created a Restful api using OWS.

If so how do you deal with

  1. Authentication. Do you use secret/public keys and encryption
  2. Identifying the method being used (Post/Put/Get/Delete)

Any hints, tips and examples are greatly appreciated

Tony

New Post
8/2/2015 10:00 AM
 
Hi Tony, 


 I created an OWS config for login/authentication that log-in via dnn (by ows userinfo object) and create a token (with a duration/policy, in db table) and a model of OWS config that validate token (via goto configuration) and do-the-works. 


So when I have to create a new REST WS I simply create a dnn page, drop a ows module with a copy of this configuration and then customize the logic. 


 for example : 


 http://www.mysite.com/ws/auth?u=login&p=password 


 (page with login ows module that response a valid token for X seconds/minutes ) 


 and 


 http://www.mysite.com/ws/do-the-work?t=&mypar1=xxx&mypag2=yyy 


 or post parameters I used XML to retrieve data and response.contenttype to application/xml to stream the response. 


The problem I had is that the POST parameters is only in application/x-www-form-urlencoded so I can read some like :


 MYPOSTVarXMLRequest= <myComplexRequest/>


 or 


 MYPOSTVarJSONRequest={myComplexRequest:1} 


 but not directly stream in XML or JSON 


 Hope it helps


Roberto

New Post
11/25/2015 8:26 AM
 

I was wondering if anyone could elaborate on creating a REST API via OWS.


I am able to handle GET requests simply with the FILE action with destination type "Outgoing Response".


I am trying to work out handling POST requests - I do not know how to have OWS access the body content.



Nevermind - figured it out.  Using a QUERY for System-Form, I am able to access the content and using a QUERY for System-Headers I can access the headers.



thanks!

Previous
 
Next
HomeHomeCoreCoreGeneralGeneralCreating a RESTful API with OWSCreating a RESTful API with OWS


 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA • info@openwebstudio.com

Bookmark & Share Bookmark and Share