Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Formatting output

$
0
0

I have some rather inflexible consumers of an API I wrote that require nested collections to be of length two with specified key names. Not a difficult task, however I wonder if something already exists so I can look over the implementation and possibly produce something the first time that is future proof and maybe more correct?

One possibility I thought of was allowing for query parameters where I could specify what key contained what value: http://server/path/id?desiredPropNameA=existingPropNameA&desiredPropNameB=existingPropNameB

This would return what the consumer wants:

{
  {"desiredNameA": "existingPropNameA-Value", "desiredNameB": "existingPropNameB-Value"}
}

Viewing all articles
Browse latest Browse all 4850

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>