How to create a user using RESTServer in Drupal?

Using REST Server 6.x-2.0-beta3, I'm trying to figure out how to send user.save messages.

curl -d 'XX' -v http: // localhost / services / rest / service_user / save

I tried replacing XX:

  • account {'Name': 'MyName', 'transfer': 'my password', 'mail': ' my@email.org '}
  • account = {'name': 'myname', 'pass': 'mypassword', 'mail': ' my@email.org '}
  • account = "name = MyName, pass = my password, mail = myemail.org"
  • account = name = MyName, pass = MyPassword, mail = myemail.org
  • account = MyName, my password, myemail.org

But none of them seems correct, and finding any documentation regarding this is almost impossible.

I also tried the following:

curl -H "Content-Type: application / json" -d 'account = {"name": "myname", "pass": "mypassword", "email": "123"}' -v http: // localhost / services / rest / service_user / save

The error in this case is:

HTTP / 1.0 406 Not Allowed: Missing Account with Argument

+3
source share
2 answers

I understood:

curl -H "application/x-www-form-urlencoded" -d "sessid = xxxx" -d "account [] = MyName & account [pass] = mypass & account [mail] = myemail @gmail. com & account [conf_mail] =myemail@gmail.com" -v http://path-to-site/services/rest/service_user/save

-d "sessid = xxxx", , . , xxxx ( system.connect).

+1

, , JSON.

node, :

URL: http://path-to-site/services/rest/node

: Content-Type: application/json

: { "type": "story", "title": "REST Test", "body": "REST using JSON" }

, URL

+2

Source: https://habr.com/ru/post/1790748/


All Articles