I am making REST Service calls to my Drupal 7 site to either retrieve or create content.

Is there a way I can make all these calls through one specific authenticated user?



You can use jdrupal.min.js. and set variables as follows in your js:

 Drupal.settings.site_path = "http://example.com"; // SET Drupal site Path  
 Drupal.settings.endpoint = "services_endpoint_name";  // Set the Service Resource REST endpoint path FROM services module in Drupal site.

and you can use directly functions for for doing operation such as:

user_login(username, password, {
                        success: function (result) {
                        error: function (xhr, status, message) {
                            console.log(status +" Error Message"+ message)

If login successful then you are logged in with the authenticated user in your Drupal site. And also you can do number of operations node save, update, delete etc.

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.