I am creating an XML API using the Grape Gem. What is the best way to create XML for API actions? Since Grape does not use standard rail controllers, I cannot use views/../xml.builder . What did you suggest? Maybe there are some recommendations for creating xml api?
views/../xml.builder
Sinece there are no answers, I will answer my question. I ended up with modules where I declare different xml responses and include these modules in my Grape API. In API actions, I just call the response methods from these modules. With this approach, my code is clear and divided.
It seems to be a sample. Just specify the format to tell the grape your default format.
format :xml content_type :xml, "text/xml"
Then add .xml to the end of the request URL.
.xml
Source: https://habr.com/ru/post/923371/More articles:android - How to create a table in the body of a letter - androidTaking the good parts of both Spring and php in a common server environment - springSearch column name in all databases - sql-server-2008How to set up a remote Hbase server for my Java application - javaHow to get the maximum number of indexes for TemplateRepeatIndex in DWT - tridionDo I need to highlight integers - phpHow to read XML file using JAXB? - javaHow to find if there are n consecutive bits in a 32-bit buffer? - algorithmHow to deal with confusing usage dependencies to start unit testing? - unit-testingLink to form label using route - symfonyAll Articles