0

We have a Java application on our server, when users provide their email and username to it I want it to send the username and email to our Drupal site to register them for an account. And I'd like them to still receive Drupal's welcome email containing their password.

What's the best way to achieve this, I was thinking possibly the services module? But wasn't sure if there'd be a better solution because the Java code and Drupal site are on the same server and therefore we could have some pretty direct integration.

| improve this question | | | | |
  • Post JSON Data to drupal site like drupal_site.com/newuser and in the page callback function do a user_save – GoodSp33d Feb 28 '12 at 5:24
1

I may be biased b/c I am the Services module maintainer, but, You don't want to be directly inserting things into the database.

You could REALLY break Drupal by doing this.

If you didn't want to use services module(which why wouldn't you?) you should really use Drupal's apis to put things in the database, like, node_save, or drupal_form_submit(which is what services does).

This ensures that Drupal actually enters the data and will lead to a cleaner overall integration with less problems.

In Drupal 6.x this json actually creates a user when POSTed to SERVER/ENDPOINT/user.

{"uid":"1","name":"admin","pass":"1a1dc91c907325c69271ddf0c944bc72","mail":"kyle@workhabit.com","mode":"0","sort":"0","threshold":"0","theme":"","signature":"","signature_format":"0","created":"1286571725","access":"1294792121","login":"1293782855","status":"1","timezone":null,"language":"","picture":"","init":"kyle@workhabit.com","data":"a:0:{}","roles":{"2":"authenticated user"}}
| improve this answer | | | | |
  • Hey Kyle, thanks for chiming in, I don't have much experience with services yet so wasn't sure about the integration but it looks like that's the best way to go so I'll go figure it out :) thanks. – Sean Bannister Feb 28 '12 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.