2016-08-31 2 views
1

저는 Drupal8이 포함 된 Angular2 웹 앱을 백엔드에 작성하고 있습니다. API 종점 "/ taxonomy/term/{taxonomy_term}"을 사용하려면 분류 ID를 각 레이블로 변환해야합니다. 올바른 REST-API를 사용하고 모든 역할에 대한 액세스 권한을 부여했지만 ID 및? _ 형식 = json으로 끝점에 액세스하려고하면 '{ "메시지": "받아 들일 수없는 형식 : json "}". 그러나? format = json을 제거하면 HTML에서 원하는 결과를 얻을 수 있습니다.Drupal8 분류 용어에 대한 REST-api가 작동하지 않습니다.

이 오류 메시지는 파일 /core/lib/Drupal/Core/EventSubscriber/AcceptNegotiation406.php에서 발견하고 다음 주석 앞에는 :

// If this is a render array then we assume that the router went with the 
    // generic controller and not one with a format. If the format requested is 
    // not HTML though we can also assume that the requested format is invalid 
    // so we provide a 406 response. 

이 사람이 나를 도와 드릴까요? 또는 HTML 결과에서 택 소노 미 레이블을 다듬어야합니다.

+0

API 요청의 전체 URL은 "http : //bfo.no.drupal.rasmus : 7070/taxonomy/term/9? _format = json"이지만 Google 네트워크 외부에서는 사용할 수 없습니다. – rasmusrim

답변

2

Structure > Views에서 "분류 용어"보기를 비활성화하십시오.

이보기는 RESTful 웹 서비스 모듈로 작성된 /taxonomy/term/{taxonomy_term} 끝점을 무시합니다. "REST 내보내기"디스플레이를 추가하지 않으면 JSON 형식 요청을 수락하지 않습니다.

관련 문제