utilizing text/plain

2007-11-19 @ 18:25#

last week i needed to quickly put together some URLs that returned a simple value (an integer). because we do so much in my current assignment with a 'standardized' XML API, my first inclination was to put together our typical "POST an XML request, recieve an XML response, trundle the resulting doc for the value(s) you want" pattern. but that was too big an axe for such a small chicken [grin].

instead, i worked up a simple server script that returned a plain/text document with the value i expected along with a 200 OK status. if the URL was badly formed (400 Bad Request) or the requested data was missing (404 Not Found) i just returned the proper status and left it at that.

no complex envelope/documents, no messy return data to evaluate. just text/plain. sweet!

code