26.04.2018, 16:11 | #1 |
Участник
|
goshoom: XML response from OData services
Источник: http://dev.goshoom.net/en/2018/04/xm...data-services/
============== If you call OData services in AX 7 (Dynamics 365 for Finance and Operations), you typically get data in JSON format, like this: { "@odata.context":"https://myaxinstance.cloudax.dynamics.com/data/$metadata","value":[ { "name":"ElectronicPaymentTypes","kind":"EntitySet","url":"ElectronicPaymentTypes" },{ "name":"ExpensePaymentDetails","kind":"EntitySet","url":"ExpensePaymentDetails" } ... ]} JSON is a simple, lightweight format with good support in many tools, but sometimes you would rather get XML. XML is by no mean deprecated – it’s more than a format; you get a whole platform with capabilities useful for validations (XML schema), querying (XPath, XQuery), transformations (XSLT) and so on. Or you simply have a component that accepts only XML and not JSON. Fortunately OData services aren’t limited to JSON; they can return XML as well. Simply add HTTP header Accept with value application/atom+xml,application/atomsvc+xml,application/xml and you’ll start getting the same data in XML format: </span> </span> </span>ElectronicPaymentTypes</span> </span>ElectronicPaymentTypes</span> </span> </span> </span>ExpensePaymentDetails</span> </span>ExpensePaymentDetails</span> </span></span> ... </span></span> If you use Postman, for example, this is where you can put the header: Of course, that you get XML format doesn’t mean that you get the structure you want. You still may need to transform it to something more suitable for your purposes. Источник: http://dev.goshoom.net/en/2018/04/xm...data-services/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
За это сообщение автора поблагодарили: gl00mie (2). |
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|