cancel
Showing results for 
Search instead for 
Did you mean: 

Create a New User Registration Form

kennetjacob
Champ in-the-making
Champ in-the-making
Hi…
     Iam a newbie in Alfresco. I like to create a new user registration form in share. I studied about the javascript people API to create new user, but don know how to access the javascript API from share. Can you please provide me some sample how to make remote call to javascript API and create a new user. Pl help me.. :?  :?  :?

Thanks in Advance.

Kennet
5 REPLIES 5

kevinr
Star Contributor
Star Contributor
The APIs you can are called "person" - look at this URL on your deployed Alfresco instance:
http://localhost:8080/alfresco/service/index/uri/
search for /person and /people
- those are the Webscript api urls that Share uses.
Here are the docs: http://wiki.alfresco.com/wiki/Repository_RESTful_API_Reference#Add_Person

The people API expects a JSON request, something like this:

var myPerson = {
   "userName":"test1",
   "password":"password",
   "firstName":"Test",
   "lastName":"User",
   "email":"test@test.net",
   "disableAccount":false,
   "quota":-1,
   "groups":[]
};
To call an API like this from a WebScript component JavaScript controller in Share is easy:

var json = jsonUtils.toJSONString(myPerson);
var conn = remote.connect("alfresco");
conn.post("/api/people", json, "application/json");
And that's it!

Take a look at the "Users" Admin Console page in Share and the code behind it (files called users.get.* and users.js) for a more advanced example.

Note that only a logged in admin user can create people!

Kev

kennetjacob
Champ in-the-making
Champ in-the-making
Thanks alot Kevin. The information u gave is very useful for me. Now i created a new user registration page with the help of the code u gave and i referred the admin console page "Users". Everything works fine…Thanks Smiley Very Happy  Smiley Very Happy

kennetjacob
Champ in-the-making
Champ in-the-making
And one more thing Kevin, Actually i want to develop a new application like share, How can i start ?? can you please guide me..

kevinr
Star Contributor
Star Contributor
Great to hear the example works. As far as developing a whole new app, well that's quite a question! I guess a good example would be to checkout the Alfresco code svn and look at the "mobile" project - this is an example of a "mini Alfresco Share" - a SpringSurf app written from scratch to provide some of the basic Share features on an iOS device. That's probably a good place to start… It makes use of the same Alfresco REST APIs that Share does, has a login page, list of sites, docs, content etc.

Cheers,

Kev

kennetjacob
Champ in-the-making
Champ in-the-making
I have downloaded the Alfresco code from svn, I will look through the "mobile" project and let u know Kevin. I was confused where to start :? .. I think the information you gave will help me.. Smiley Happy  Thanks for your information Kevin..

Thanks,
Kennet