1.请求token
http://drupal8.sh1.newtouch.com/rest/session/token
2.创建节点(postman方式)
Authorization 输入用户名和密码 然后update request
Header 添加 X-CSRF-Token 值为第一步获取的token
Content-Type application/hal+json
Accept application/hal+json
请求内容为raw格式
{ "_links": { "type": { "href": "http://drupal8.sh1.newtouch.com/rest/type/node/movies" } }, "type": { "target_id": "movies" }, "title": { "value": "content from mobile" }, "body": { "value": "thanks for giving this node, it's nice." } }
其中type:target_id属性可有可无
3.后台开启rest,安装restui模块,启用content资源,设置认证方式为basic_auth和cookie
板块
标签
Drupal 版本