rest api xml incoming data

in Yii2 rest-api, how handled xml incoming data?

Yii2 implementation provide only 2 incomng datatype, normal POST form data or JSON.

You can enable json incoming data by enabling the configuration:

http://www.yiiframew…ling-json-input

You can still write your parse starting form the one for json

vendor/yiisoft/yii2/web/JsonParser.php

It is just few lines.

Depends on the xml you send, but it should be sufficient to change the line




return Json::decode($rawBody, $this->asArray);



to give back similar format starting form xml

Yii has no helpers for xml, you need to use php function like simple xml.

[color="#006400"]/* Moved from "General Discussions" to "REST APIs" */[/color]