Import XML type REST API to Mendix

0
Hello I’m trying to import XML data about bus information that is provided by government.  The government site only provides XML type REST API, so i have to use XML data.  i’ve tried to  find docs about importing XML data, but it only explains about xml schema. i want to import xml data from site in real time to show when buses arrive at specific bus station and i want to see buses movement on the google map. if anyone has ideas about it, please tell me the direction to solve this problem.
asked
1 answers
0

Hello Hoijoo Kim,

When consuming rest services, both JSON and XML data formatting are supported. The mendix documentation says the following: (https://docs.mendix.com/refguide/consumed-rest-services)

 

Representational state transfer (REST) is an approach to consuming or exposing resources. It has gained popularity because of its simplicity, because no extensive schemas or contracts are needed to transfer data between endpoints. It uses the following:

  • HTTP URLs to locate resources
  • HTTP headers to authenticate and specify content types (such as XML or JSON)
  • HTTP methods to identify operations on resources, such as GET (retrieve data) or POST (send data)

 

So in your case you would be able to get the REST service you are consuming working if you set the headers correctly to specify the XML content type. Next to this you have to apply the correct mappings for the data. There are main ways of creating an import mapping, documentation: https://docs.mendix.com/refguide/import-mappings

Hope this helps.

answered