2015-11-04 33 views
4

我在嘗試使用Lambda函數集成Amazon API網關。我成功地實現了,但是當我用curl嘗試時失敗了。亞馬遜APi網關無法生成轉換請求

設置Lambda方法,API網關集成以及集成請求下的模板映射。

當我從控制檯運行「測試」,它工作正常

Execution log for request test-request 
Wed Nov 04 07:27:30 UTC 2015 : Starting execution for request: test-invoke-request 
Wed Nov 04 07:27:30 UTC 2015 : API Key: test-invoke-api-key 
Wed Nov 04 07:27:30 UTC 2015 : Method request path: {service=xml} 
Wed Nov 04 07:27:30 UTC 2015 : Method request query string: {} 
Wed Nov 04 07:27:30 UTC 2015 : Method request headers: {} 
Wed Nov 04 07:27:30 UTC 2015 : Method request body before transformations: Articletext 
Wed Nov 04 07:27:30 UTC 2015 : Endpoint request body after transformations: { 
    "prog" : "xml", 
    "content" : "Articletext", 
    "test" : "{path={service=xml}, querystring={}, header={}}" 
} 

但是當我試圖通過捲曲訪問它不能夠轉化

捲曲後創造適當的身體 - X POST https://aaaaaaa.execute-api.us-west-2.amazonaws.com/beta/apitest/xml -H 「內容類型:應用/ X WWW的窗體-urlencoded;字符集= UTF-8」 --data二進制 「Articletext」

Starting execution for request: 
Method request path: {service=xml} 
Method request query string: 
{} 
Method request body before transformations: Articletext 
Endpoint request body after transformations: Articletext 
Endpoint response body before transformations: 
{ 
    "Type": "User", 
    "message": "Could not parse request body into json." 
} 

任何人可以建議我關於缺失部分?

+0

捲曲的內容類型是問題。我將其更改爲application/json。 – Yawar

回答