I’m trying to define how to return XML content from my web API.
Should the root element of the web server response always be called “Content”, or should I define a (possibly) different root element for each of the API calls’ reponses? Or do I even need a root key at all?
The API we maintain has a single constant root element. Really it is up to you. Other alternatives might be a different roots per data return type, different roots for classes, or as you say, different roots per function.
Our API is structured something like this (not that it is a standard or anything):
We also allow batch calling, so this helps with determining which results are which.