I am developing a website that uses external Drupal for articles and pages. The goal is to display articles on a website using only html / css / js.
I added the Rest Server module to the backpen drupal so that I can execute HTTP requests to return articles. Now back to the articles from the back drupal works (see Code below). Restdrupal is the name of my site, and restendpoint is the name of the Rest (Captian Obvious) server endpoint
$.ajax({ url : "http://127.0.0.1/restdrupal/restendpoint/node.json", dataType : 'json', success : function(data) {
Now I want my client to be able to add some articles, so I need to log in first. I searched the internet for several days and tried millions of things, but nothing worked for me. The last thing I tried (with jQuery) was this:
$.ajax({ url : "http://127.0.0.1/restdrupal/restendpoint/user/login", dataType:'application/json', type : 'PUT', data : 'Name=myusername&Pass=mypassword', success : function(data) {
I also changed PUT to POST ...
The answer I get is (not what I do) the same thing:
406 Not Acceptable: Unsupported request content type application/x-www-form-urlencoded
Can anyone help me? Regards, Ceetn
Ceetn source share