2017-02-19 5 views
0

노새에서 ../api/items 및 ../api/items/{itemId}에 대한 끝점을 동시에 제공하는 방법은 무엇입니까?Mule ApiKit - ../api/items 및 ../api/items/{itemId}의 끝점을 동시에 표시 하시겠습니까?

내가 어떻게 엔드 포인트에 대한 ApiKit 작업을하는 .. 내가 정확히 https://support.mulesoft.com/s/article/ka434000000TPOz/Method-not-Allowed-on-API-Kit-requests

에 정의 그러나 언급 된 솔루션이없는 한 ../api/items를 호출 할 때 내가 nullpayload와 exeption을 얻을 궁금 해서요 실질적으로 적용 가능

답변

0

APIkit 라우터 전에 그루비 스크립트를 추가하기 만하면 해결되었습니다.

그것은

import org.mule.api.transport.PropertyScope 

if(message.getInboundProperty('http.request.path') == '/api/items') 
    message.setProperty('http.request.path', '/api/items/*', PropertyScope.INBOUND)` 

입니다 그리고 나는 항목 ID로 스타 *을 볼 때 나는

0

ram1에서이 종점은 모두 유효합니다. 당신은 이것을 사용할 수 있습니다.

+0

내가 엔드 포인트에 대한 ApiKit 작업을하는 방법 궁금 흐름 구현에 따라 행동 .. 내가 얻을 ../api/items, ../api/items/{itemId}를 호출하면 nullpayload 및 exeption이 정상적으로 작동합니다. – mCeviker