AWS API Gateway accept Content-type: application/xml

自古美人都是妖i 提交于 2019-12-06 10:29:31

问题


I've got a question about AWS API Gateway..

I want to process an other companies API into my own dynamoDB in AWS. They can only POST an XML formatted to my API. My setup is API Gateway -> Lambda -> DynamoDB.

But how can do set up a API Gateway POST in such a way that i accepts the XML posted by them?

Link to their XML Post setup (it's just the uplink data): http://zakelijke-community.kpn.com/t5/Data/Application-data-API/ta-p/4768


回答1:


You can define a request mapping template for "application/xml" which will be triggered when the client sends a "Content-Type" header of "application/xml".

While API Gateway doesn't yet offer first-class support for XML, you can simply send the XML payload to Lambda in a JSON string field:

{ 
   "bodyXml" : "$input.body"
}

In your Lambda function, you can use your XML parsing library of choice to process the XML.

Hope this helps, Ryan



来源:https://stackoverflow.com/questions/37164698/aws-api-gateway-accept-content-type-application-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!