DNN 7 web services API documentation?
Last Post 09/19/2015 5:57 AM by apurva gandhi. 7 Replies.
Author Messages
Web Services
Nuke Master
Nuke Master
Posts:322


--
10/28/2013 5:39 PM  
I'm trying to write some custom web services to log users into a dnn portal from another application. I followed the tutorial to get a simple web service going.

Right now, if you browse to mysite.com/DesktopModules/MyServices/API/User/Login I have it working as to test a login. Basically, I have a controller UserController with one method called login.

In that page I'm simply doing

public class UserController : DnnApiController
{
[AllowAnonymous]
[HttpGet]
public string Login()
{
string resp = System.Web.Security.Membership.ValidateUser("hostUserName", "hostPass").ToString();
return resp;
}
}

Where I set the correct un and pass and I get true back. So, I know that this is working to see if that would log in the user.

However, I cannot find any documentation on all the features I should be able to access. Maybe I'm just not looking in the right places? Basically I need to be able to send data across so when I user logs in on my application, if it works with DNN, it logs them in in both places, so if they bounce from my custom site to DNN, they're logged in across the board. I'm sure there are pages out there with all the classes I can access, I just don't know what to google. What would those be? Thanks



Joseph Craig
DNN MVP
Posts:11667


--
10/28/2013 9:40 PM  
As login things involve security issues, you might also look at how "single sign-on" things work. Take a look at the code for the DNN authentication providers for Facebook and /or Active Directory.

If you google "DNN Single Signon" you will find lots of reading material.

Joe Craig, Patapsco Research Group
Complete DNN Support
Anthony
Nuke Newbie
Nuke Newbie
Posts:8


--
11/01/2013 12:15 PM  
Hi,
I'm developing a dnn database, and am looking for a way of validating the username/password from an app, without actually logging on to the database, and it seems you've have done exactly that using the DNN 7 wab api to validate the user.
Could I ask you what tutorial you used to get this working (I'm a SQL developer, so need as much help as possible). Also is it possible to return any user data such as userid using this method?
Any help appreciated.
Regards
Web Services
Nuke Master
Nuke Master
Posts:322


--
11/01/2013 2:49 PM  
Sure, validating a user is actually super easy. Just download your whole DNN site and db and get it running locally. Then, open it with VS and follow this tutorial

http://www.dnnsoftware.com/communit...PI-Edition

Once you get the hello world app working, just drop this function in and then call it via yourdomain.com//DesktopModules/MyServices/API/Welcome/ValidateUser?username=someUser&password=somePass

[AllowAnonymous]
[HttpGet]
public string ValidateUser(string username, string password)
{
return System.Web.Security.Membership.ValidateUser(username, password).ToString();
}

You'll probably want to secure that over ssl, and have a key that you're passing as well. You could also pass in json or post data as well. Just change the HttpGet to HttpPost or whatever method you want to use. That will return true if it's a valid user, and false if it's not.

Let me know if you need help getting the DNN web services thing created.
Anthony
Nuke Newbie
Nuke Newbie
Posts:8


--
11/04/2013 3:33 AM  
Thanks, that's great. I'll give it a go.
apurva gandhi
Nuke Newbie
Nuke Newbie
Posts:5


--
09/16/2015 1:04 AM  
Hi,
I want create DNN Web service for registration form, login form and security rights , which will use in external Application.

Thanks.
Joseph Craig
DNN MVP
Posts:11667


--
09/16/2015 9:24 AM  
This might be a good place to start: http://www.dnnsoftware.com/wiki/ser...ork-webapi

Joe Craig, Patapsco Research Group
Complete DNN Support
apurva gandhi
Nuke Newbie
Nuke Newbie
Posts:5


--
09/19/2015 5:57 AM  
Thanks It's working.

I have implemented Simple method in DNN Web Api which Gets All Roles with having DnnAuthorize attribute , which is working if i logged in to my DNN site.
But when I call from external application it gives "Authorization has been denied for this request" .
So I want to implement Login and Authentication Methods in DNN web api .

Please let me know.

Thanks


---