admin管理员组文章数量:1301534
I am working with WSO2 API Manager / WSO2 EI and trying to fetch appointment data from two different APIs (Vodafone and TalkTalk). The Vodafone API returns a JSON array, while the TalkTalk API returns a JSON array. The first placed sequence mediator fetches and appends correctly but second gives me error
When I send the response from my API, I get the following error:
<resource methods="POST" uri-template="/get-available-appointments">
<inSequence>
<log level="custom">
<property name="Step" value="Starting get-available appointments API"/>
</log>
<sequence key="GetVodafoneAvailableAppointmentsSequence"/>
<sequence key="GetAvailableAppointmentsSequence"/>
<payloadFactory media-type="json">
<format>
{
"VodafoneAppointmentResponse": $1,
"TalkTalkAppointmentResponse": [$2]
}
</format>
<args>
<arg evaluator="xml" expression="get-property('VodafoneAvailableAppointmentsResponse')"/>
<arg evaluator="xml" expression="get-property('AvailableAppointmentsResponse')"/>
</args>
</payloadFactory>
<respond/>
</inSequence>
</resource>
The TalkTalkAppointmentResponse is being treated as an array, but the API expects a JSON object.
How can I properly structure the TalkTalk API response so that it is accepted as a JSON object instead of an array?
<payloadFactory media-type="json">
<format>
{
"VodafoneAppointmentResponse": $1,
"TalkTalkAppointmentResponse": {
"appointments": $2
}
}
</format>
<args>
<arg evaluator="xml" expression="get- property('VodafoneAvailableAppointmentsResponse')"/>
<arg evaluator="xml" expression="get-property('AvailableAppointmentsResponse')"/>
</args>
</payloadFactory>
本文标签:
版权声明:本文标题:WSO2 API Error: "Invalid schema for content type applicationjson. Expected JSONObject, found JSONArray" - Stac 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741665838a2391302.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论