Drupal 8에서의 Restful 서비스

· 10년 전 · 1432

http://www.appnovation.com/blog/setup-drupal-8-restful-web-services-3-easy-steps 

 

1. Admin>Extend> Web Services에서 (화면 제일 아래)

 

HAL, HTTP Basic Authentication, RESTful Web Services, Serialization을 모두체크 하고 Save

 

2. Admin>People>Permissions> RESTful Web Service

에서 Access GET on Content resource의 Anonymouse user에 체크 그리고 저장

 (세팅이 길으니,  헤더가 중간에 따라 다니네요.. 어색하지만, 편하기도 하네요)

 

https://drupalize.me/blog/201402/your-first-restful-view-drupal-8 

 

3. Generate content가 없어서. Admin>Content>add Content에서

4. admin>Structure>views>Add New View

5. 중간 위에 PATH Settings의 path에 원하는 path입력

 

https://drupalize.me/blog/201401/introduction-restful-web-services-drupal-8

 

Authenticated user의 POST, DELETE, PATCH에 대한 것입니다. 

 

5번에 대한 출력은 

[code]

[

  {

    "nid": [

      {

        "value": "19"

      }

    ],

    "uuid": [

      {

        "value": "4568eb80-7909-48b1-b30e-14dddd712bfe"

      }

    ],

    "vid": [

      {

        "value": "19"

      }

    ],

    "type": [

      {

        "target_id": "article"

      }

    ],

    "langcode": [

      {

        "value": "en"

      }

    ],

    "title": [

      {

        "value": "Test title"

      }

    ],

    "uid": [

      {

        "target_id": "1"

      }

    ],

    "status": [

      {

        "value": "1"

      }

    ],

    "created": [

      {

        "value": "1440092302"

      }

    ],

    "changed": [

      {

        "value": "1440093081"

      }

    ],

    "promote": [

      {

        "value": "1"

      }

    ],

    "sticky": [

      {

        "value": "0"

      }

    ],

    "revision_timestamp": [

      {

        "value": "0"

      }

    ],

    "revision_uid": [

      {

        "target_id": "0"

      }

    ],

    "log": [

      {

        "value": ""

      }

    ],

    "path": [

      {

        "alias": null,

        "pid": null

      }

    ],

    "body": [

      {

        "value": "test body",

        "format": "basic_html",

        "summary": ""

      }

    ],

    "field_comment": [

      {

        "status": "2",

        "cid": "5",

        "last_comment_timestamp": "1440093016",

        "last_comment_name": "",

        "last_comment_uid": "1",

        "comment_count": "2"

      }

    ],

    "field_image": [

      {

        "target_id": "30",

        "display": null,

        "description": null,

        "alt": "",

        "title": "",

        "width": "520",

        "height": "310"

      }

    ],

    "field_tags": [

      {

        "target_id": null

      }

    ]

  }

[/code]

|
댓글을 작성하시려면 로그인이 필요합니다.

자유게시판

+
제목 글쓴이 날짜 조회
10년 전 조회 1,470
10년 전 조회 1,950
10년 전 조회 1,122
10년 전 조회 1,495
10년 전 조회 1,715
10년 전 조회 1,291
10년 전 조회 1,395
10년 전 조회 1,819
10년 전 조회 1,658
10년 전 조회 1,157
10년 전 조회 1,092
10년 전 조회 1,748
10년 전 조회 1,195
10년 전 조회 1,128
10년 전 조회 1,433
10년 전 조회 1,065
10년 전 조회 1,381
10년 전 조회 1,072
10년 전 조회 1,105
10년 전 조회 1,352
10년 전 조회 1,111
10년 전 조회 893
10년 전 조회 1,168
10년 전 조회 2,139
10년 전 조회 926
10년 전 조회 2,161
10년 전 조회 1,167
10년 전 조회 1,911
10년 전 조회 2,977
10년 전 조회 1,819
🐛 버그신고