<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Notmessenger&#039;s messages</title>
	<atom:link href="http://www.notmessenger.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.notmessenger.com</link>
	<description>What is difficult takes time, what is impossible takes a little longer</description>
	<lastBuildDate>Mon, 02 Apr 2012 03:25:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Help me stop SOPA!</title>
		<link>http://www.notmessenger.com/sopa/help-me-stop-sopa/</link>
		<comments>http://www.notmessenger.com/sopa/help-me-stop-sopa/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 03:05:18 +0000</pubDate>
		<dc:creator>Jeremy Brown</dc:creator>
				<category><![CDATA[SOPA]]></category>

		<guid isPermaLink="false">http://www.notmessenger.com/?p=244</guid>
		<description><![CDATA[Lamar Smith has been the Republican Congressman for the 21st congressional district in Texas since 1987 and is the individual that introduced the SOPA legislation.  Well, my good friend <a href="http://richardmorgan.com">Richard Morgan</a>, a fellow PHP developer, is running against him in the upcoming primaries and needs your help.  <a href="http://richardmorgan.com">Richard Morgan</a> opposes SOPA and will make it a priority to oppose this and other big-government bills that threaten individual liberty and discourage job growth and free enterprise in America.
<a href="<?php echo get_permalink(); ?>"> Read More...</a>]]></description>
			<content:encoded><![CDATA[<p><strong>What is SOPA and why is it bad?</strong></p>
<p>While this article, <a href="http://money.cnn.com/2012/01/17/technology/sopa_explained/index.htm">linked here</a>, does a good job of explaining things I&#8217;m going to quickly summarize what this is all about.  SOPA is an acronym for the Stop Online Piracy Act (its text can be read here: <a href="http://thomas.loc.gov/cgi-bin/query/z?c112:H.R.3261:">http://thomas.loc.gov/cgi-bin/query/z?c112:H.R.3261:</a> ), and is a proposed bill aimed at cracking down on copyright infringement by restricting access to sites that host or facilitate the trading of pirated content.  On the whole this does not seem like such a bad thing and almost everyone would agree that this is a worthy goal to try and attain.  The problem, however, is how this proposed bill goes about obtaining this goal.  Any site could be in violation of the law if they &#8220;facilitate&#8221; copyright infringement.  The problem with this is that the word &#8220;facilitate&#8221; invites very broad interpretations of its meaning.  In addition, any site accused of being a &#8220;facilitator&#8221; will have all services &#8211; network connectivity and payment services, among others &#8211; cut off in an &#8220;ask questions later&#8221; approach.  The filing of false notifications against an online property is a crime, but the burden of proof that a crime was not committed lies with the site that has just been taken down.</p>
<p>This is a horrible piece of proposed legislation that will very likely have a far-reaching and potentially-devastating impact on the internet as a whole.  As a professional software developer that has made his living developing internet applications for the past 13 years, and did so un-professionally for several years prior to that, I cannot allow this legislation to become law.</p>
<p><strong>How can you help stop SOPA?</strong></p>
<p>Lamar Smith has been the Republican Congressman for the 21st congressional district in Texas since 1987 and is the individual that introduced the SOPA legislation.  Well, my good friend <a href="http://richardmorgan.com">Richard Morgan</a>, a fellow PHP developer, is running against him in the upcoming primaries and needs your help.  <a href="http://richardmorgan.com">Richard Morgan</a> opposes SOPA and will make it a priority to oppose this and other big-government bills that threaten individual liberty and discourage job growth and free enterprise in America.  There are three things that you can do to help <a href="http://richardmorgan.com">Richard Morgan</a> win the election:<span id="more-244"></span></p>
<ol>
<li><strong>VOTE.</strong>  Make sure to vote for <a href="http://richardmorgan.com">Richard Morgan</a> in the primary on May 29, 2012.  Early voting starts approximately 2 weeks before this.  Here is a link to the areas included in Texas&#8217;s 21st Congressional District: <a href="http://gis1.tlc.state.tx.us/?PlanHeader=PLANC235">http://gis1.tlc.state.tx.us/?PlanHeader=PLANC235</a></li>
<li><strong>DONATE.</strong> It&#8217;s safe to say that most of you reading this do not live in Texas&#8217;s 21st Congressional District and therefore cannot vote for <a href="http://richardmorgan.com">Richard Morgan</a>.  However, you can help him raise funds to get the message out to those voters that do live in the district.  The unique thing about this primary race is that SOPA affects so many more people than just those living within the district <a href="http://richardmorgan.com">Richard Morgan</a> will represent.  The ramifications of SOPA transcend local, state and even national boundaries.  Anyone, anywhere can donate to <a href="http://richardmorgan.com">Richard Morgan</a>&#8217;s congressional campaign and I strongly encourage you to do so.  Visit <a href="http://richardmorgan.com/contribute/">http://richardmorgan.com/contribute/</a> to make a contribution today!</li>
<li><strong>SPREAD THE WORD.</strong> Help me get Richard&#8217;s message out &#8211; accessible here: <a href="http://www.richardmorgan.com/issues">http://www.richardmorgan.com/issues</a> &#8211; to as many people and companies as possible before the May 29, 2012 primary date.  The more people and companies that know about this the more visibility his campaign will garner.  More visibility will mean increased voter awareness and increased donations.  Increased donations will result in increased voter awareness.
<p>Locations you can direct your friends to:</p>
<p><strong>Website:</strong> <a href="http://richardmorgan.com">http://richardmorgan.com</a><br />
<strong>Twitter:</strong> <a href="http://twitter.com/#!/Morgan4TX">@Morgan4TX</a><br />
<strong>LinkedIn:</strong> <a href="http://www.linkedin.com/in/rickmorgan">http://www.linkedin.com/in/rickmorgan</a><br />
<strong>Facebook:</strong> <a href="https://www.facebook.com/Morgan4TX">https://www.facebook.com/Morgan4TX</a>
</li>
</ol>
<p><strong>Let our voices be heard</strong></p>
<p>Our government is supposed to be for the people, by the people.  It is one where every individual voice is supposed to matter and carry with it the ability to instigate change.  Help me make those ideals a reality.  <strong><u>Please</u></strong> vote.  <strong><u>Please</u></strong> donate.  And <strong><u>please</u></strong> pass along word of this campaign.  Together, united in voice, we can stop SOPA.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notmessenger.com/sopa/help-me-stop-sopa/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FreeBSD, SVN and Unrecognized URL scheme</title>
		<link>http://www.notmessenger.com/svn/freebsd-svn-and-unrecognized-url-scheme/</link>
		<comments>http://www.notmessenger.com/svn/freebsd-svn-and-unrecognized-url-scheme/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 20:37:39 +0000</pubDate>
		<dc:creator>Jeremy Brown</dc:creator>
				<category><![CDATA[svn]]></category>
		<category><![CDATA[freebsd]]></category>

		<guid isPermaLink="false">http://www.notmessenger.com/?p=237</guid>
		<description><![CDATA[I recently had the need to connect to a Subversion repository that was hosted &#8220;in the cloud&#8221; and only accessible via a https:// address.  I was on a FreeBSD server and every time I attempted to connect to the repository I would receive this error:
svn: Unrecognized URL scheme 'https://svn.web.server'
When I ran svn --version I [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had the need to connect to a Subversion repository that was hosted &#8220;in the cloud&#8221; and only accessible via a https:// address.  I was on a FreeBSD server and every time I attempted to connect to the repository I would receive this error:</p>
<p><code>svn: Unrecognized URL scheme 'https://svn.web.server'</code></p>
<p>When I ran <code>svn --version</code> I saw that there was nothing configured to handle the http(s) protocols.  To resolve this I did the following:</p>
<ol>
<li>In <code>/usr/ports/www/neon29</code> I ran <code>make clean install</code></li>
<li>In <code>/usr/ports/devel/subversion</code> I ran <code>make config</code>.  From the configuration screen I enabled the Neon WebDAV/Delta-V repo access module and then ran <code>make clean install</code> after saving the configuration.</li>
</ol>
<p>I was then able to successfully access SVN repositories hosted at http(s) addresses!  I hope this helpful to anyone in a similar situation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notmessenger.com/svn/freebsd-svn-and-unrecognized-url-scheme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework&#8230;Without Inhaling</title>
		<link>http://www.notmessenger.com/php/zend-framework-without-inhaling/</link>
		<comments>http://www.notmessenger.com/php/zend-framework-without-inhaling/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 15:51:25 +0000</pubDate>
		<dc:creator>Jeremy Brown</dc:creator>
				<category><![CDATA[beginner]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://www.notmessenger.com/?p=225</guid>
		<description><![CDATA[I recently had the privilege of being asked to write an article for php&#124;architect magazine called &#8220;Zend Framework&#8230;Without Inhaling&#8221; and the honor of being published in the November 2011 issue.  You can read all about the issue here and purchase a copy if you don&#8217;t already have a subscription.  I have previously given [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had the privilege of being asked to write an article for php|architect magazine called &#8220;Zend Framework&#8230;Without Inhaling&#8221; and the honor of being published in the November 2011 issue.  You can <a href="http://www.phparch.com/magazine/2011-2/november/" target="_new">read all about the issue here</a> and purchase a copy if you don&#8217;t already have a subscription.  I have previously given a presentation on this same topic and a video recording of it is available on the <a href="http://www.notmessenger.com/presentations/">Presentations page</a>.  Below is the article synopsis:</p>
<p><strong>Zend Framework…Without Inhaling</strong><br />
Not sure how to integrate all Zend Framework has to offer into your existing code? Do you want to know how you can use Zend Framework without having to fully adopt the MVC architecture? What if you want to begin using MVC later? This article will present ideas and examples on how you can integrate Zend Framework into your existing codebase with minimal need for future refactoring.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notmessenger.com/php/zend-framework-without-inhaling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Conversation About REST</title>
		<link>http://www.notmessenger.com/beginner/a-conversation-about-rest/</link>
		<comments>http://www.notmessenger.com/beginner/a-conversation-about-rest/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 01:01:29 +0000</pubDate>
		<dc:creator>Jeremy Brown</dc:creator>
				<category><![CDATA[REST]]></category>
		<category><![CDATA[beginner]]></category>

		<guid isPermaLink="false">http://www.notmessenger.com/?p=208</guid>
		<description><![CDATA[I recently had the opportunity to present my &#8220;A Conversation About REST&#8221; talk at ClubAJAX.  A REST API involves more than just pushing data back and forth between endpoints. REST is a set of principles and not a specification, so as such you have freedom in how to develop your API. This freedom can [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had the opportunity to present my &#8220;A Conversation About REST&#8221; talk at <a href="http://www.clubajax.org" target="_new">ClubAJAX</a>.  A REST API involves more than just pushing data back and forth between endpoints. REST is a set of principles and not a specification, so as such you have freedom in how to develop your API. This freedom can lead to confusion though, as it’s hard to find concrete examples of its implementation. This presentation explained what REST is and also presented a variety of topics and questions you will certainly come across while implementing your API.</p>
<p>The <a href="/presentations">Presentations page</a> has a link to the video recording of the talk, which was very lively with a lot of audience participation.  Definitely worth watching!</p>
<p><span id="more-208"></span></p>
<p>At the end of the presentation I make reference to an invaluable reference graphic that you owe to yourself to check out.  The url for it is <a href="http://www.aisee.com/graph_of_the_month/http.png" target="_new">http://www.aisee.com/graph_of_the_month/http.png</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notmessenger.com/beginner/a-conversation-about-rest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3 Tenets for Implementing a REST API</title>
		<link>http://www.notmessenger.com/rest/3-tenets-for-implementing-a-rest-api/</link>
		<comments>http://www.notmessenger.com/rest/3-tenets-for-implementing-a-rest-api/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 21:43:55 +0000</pubDate>
		<dc:creator>Jeremy Brown</dc:creator>
				<category><![CDATA[REST]]></category>
		<category><![CDATA[API]]></category>

		<guid isPermaLink="false">http://www.notmessenger.com/?p=158</guid>
		<description><![CDATA[REST is a set of principles and not a specification. There is not a specific implementation that makes an API RESTful, but instead certain expectations that one should strive to achieve. In this post I examine versioning your API and response bodies.]]></description>
			<content:encoded><![CDATA[<p>In the course of performing my duties at my day job I recently came across the need for our data to be accessible via an API.  After researching the various types available, I settled on developing a REST API.  The selection process wasn&#8217;t the interesting part of this exercise though.  Actually implementing a REST API is what was.</p>
<h4>REST is a set of principles</h4>
<p>If there is one point that you should take away from this post after reading it, it is this: REST is a set of principles and not a specification.  Consider for a moment someone you believe to be moral.  Traits that may make them moral, such as trustworthiness, decency or honor, are characteristics of their morality; guidelines they follow in their life &#8211; a moral code.  There is not a law that specifies what morality is, but there is a general sense of what is expected and what is meant when discussing morality.  The same holds true for REST.  There is not a specific implementation that makes an API RESTful, but instead certain expectations that one should strive to achieve. <span id="more-158"></span></p>
<p>The first place you run into &#8220;principles versus specification&#8221; is with versioning your API.  There are really only two ways to implement the concept of versioning in a REST API &#8211; either through the syntax of the URI  [this also includes using different (sub)domains for different versions] or by the use of HTTP headers.  Within the use of HTTP headers, there are two primary options &#8211; use of the X-API-Version header or the use of custom media types.  But which of these methods are correct?  This exact question is discussed several times on the following websites:</p>
<ul>
<li><a href="http://www.subbu.org/blog/2009/12/media-types-and-plumbing" target="_new">http://www.subbu.org/blog/2009/12/media-types-and-plumbing</a></li>
<li><a href="http://barelyenough.org/blog/2008/05/versioning-rest-web-services/" target="_new">http://barelyenough.org/blog/2008/05/versioning-rest-web-services/</a></li>
<li><a href="http://news.ycombinator.com/item?id=1523664" target="_new">http://news.ycombinator.com/item?id=1523664</a></li>
<li><a href="http://stackoverflow.com/questions/2024600/rest-api-versioning-only-version-the-representation-not-the-resource-itself" target="_new">http://stackoverflow.com/questions/2024600/rest-api-versioning-only-version-the-representation-not-the-resource-itself</a></li>
</ul>
<p>After reading these author&#8217;s positions, and the ensuing discussions, you are still left with our original question of which method is correct.  And there is the &#8220;principles versus specification&#8221; problem.  There isn&#8217;t a right or wrong answer about this.  There is only opinion and the solution that best serves the needs at hand.</p>
<h4>Versioning your REST API</h4>
<p>Seeing as that opinion is part of what drives your REST API implementation, and you are reading this blog post, let me take a moment to share with you my opinion on this subject.  For me, there are 3 tenets that I have followed in developing my REST API.  The two that pertain to versioning are:</p>
<ol>
<li>Do not use custom HTTP headers</li>
<li>Do not use custom media types</li>
</ol>
<p>Why these you ask? For the first one, it is because any proxy that is encountered along the transit path <i>may</i> either modify the headers or strip them off and not deliver them to their intended target.  If you are relying on the &#8216;X-API-Version&#8217; header to specify which version should be used, and it is not present in the request, then what do you do?  Revert to the oldest version?  Serve the latest?  Neither of these are good responses, as what the client gets back cannot be relied on to be consistent.  How are they to know whether or not this non-standard header is going to make it to your service or not?</p>
<p>For the second one, I do not believe that versioning of your API is as simple as saying you have a different representation of your data.  Sure, if you take a look at the following two examples it&#8217;s only about a different representation:</p>
<p><strong><a name="example1">Example 1</a></strong></p>
<pre>
&lt;customer&gt;
	&lt;name&gt;Joe&lt;/name&gt;
	&lt;phone&gt;555-555-1212&lt;/phone&gt;
&lt;/customer&gt;
</pre>
<p><strong><a name="example2">Example 2</a></strong></p>
<pre>
&lt;customer&gt;
	&lt;name&gt;Joe&lt;/name&gt;
	&lt;phone&gt;
		&lt;home&gt;555-555-1212&lt;/home&gt;
		&lt;mobile&gt;555-555-2121&lt;/mobile&gt;
	&lt;/phone&gt;
&lt;/customer&gt;
</pre>
<p>But what happens when the business logic behind the POSTing to a resource does something different than it did before?  The structure of the request, and perhaps even the response, remain the same, but the results of your actions are completely different.  This is a version change too.  Yes, technically, it&#8217;s a change to your application and not the API, but to the consuming client your application <i>is</i> your API.  If the behavior of your API changes, even if it is really your application that has, then there is need for a new version of your API.</p>
<h4>Do not use custom media types</h4>
<p>Using custom media types to represent these types of changes just does not cut it.  Custom media types can only be effectively (and questionably at that) used to serve a different representation of the response, but not a different behavior of your application.  It is for this reason that I do not use either custom HTTP headers or custom media types and instead specify the API version in the URI.  Yes, this is controversial to some but, as we have already established, the other methodologies are likely equally controversial. Heck, this approach even has its own problems for me, as I believe that a URI expresses identity, and identity does not change when a new version is introduced.  By using the URI to store the version information we give the visual impression that we are representing different, distinct resources when in fact they are the same identity.  But in the battle of &#8220;principles versus specification&#8221;, wherein the specification (or lack of one) does not give direction on this topic, and my belief in the principle that representing a change to the business logic is more important that representing identity distinctness, this is the solution that I use.  You are certainly free to disagree and implement your own solution.  The following is an overview of how I manage versioning in my API:</p>
<ul>
<li>I version my API with the versioning scheme of [Major].[Minor].[Revision]</li>
<li>Anything that encompasses a major change to the way the API works results is an increment of the [Major] value.  Let&#8217;s say that we have version 1.4.7 of our API.  We have become successful and just purchased another company.  In the process of integrating our two companies together, we have changed some of our fundamental business processes, whereas now how we process payments has completely changed due to new accounting rules, etc.  We modify our API and in order to indicate that there have been significant business rule changes, and not just presentational changes, we change the version of our API to 2.0.0.</li>
<li>Whenever there is a change in the way we interact with a REST resource, we increment the [Minor] value.  Again, we start with our API version of 1.4.7.  Using our previous examples, <a href="#example1">Example 1</a> and <a href="#example2">Example 2</a>, we change our API version to 1.5.0 after implementing the changes reflected in <a href="#example2">Example 2</a>.</li>
<li>The [Revision] value of our API version is incremented whenever we make minor additions to our resources.  Using Example 2, let&#8217;s say we want to add an additional value in the
<phone> node to represent a Work number.  As long as our change only <strong>adds</strong> additional data to a resource <strong>without</strong> making any structure changes, then an increment from version 1.4.7 to 1.4.8 is in need.  IMPORTANT: This [Revision] increase is <strong>only</strong> for when there are no changes to the existing structure!  If the consuming application is expecting to find phone numbers under the XML path of &#8220;customer > phone&#8221; adding an additional one should not cause their code to break (assuming the application is written correctly).  However, changing the name of the &#8220;Phone&#8221; node to &#8220;Phones&#8221; <strong>ABSOLUTELY</strong> will cause the the consuming application to break.  This is when a [Minor] value change is needed.</phone></li>
<li>The [Revision] value is not used for bug fixes.  Internally on our development team we have our own [Major].[Minor].[Revision] for the API codebase.  While it will likely mirror the public API&#8217;s version most of the time, the two are not in lock step with one another.  Version 1.4.7 of the API, from a consuming application&#8217;s viewpoint, is the same when there was a missing bracket in the response and the same after the required bracket was included in the response.  The API version represents the business rules of the application and presentational structure of the requests and responses.</li>
</ul>
<p>This management style results in URIs that look like these, for example:</p>
<ul>
<li>https://api.awesomesite.com/v1.4.7/article</li>
<li>https://api.awesomesite.com/v1.4.7/customer/12/orders</li>
</ul>
<h4>What is involved in maintaining this approach?</h4>
<p>Arguably, maintaining the API version in this manner requires a little bit more work.  Each version of our API is configured to be hosted as its own application on the server.  Our web server of choice is Apache.  We use the mod_rewrite engine to set the appropriate &#8216;DocumentRoot&#8217; value associated with each API version specified in the URI, defaulting to the latest version if the version specified is not recognized.  Some of the reasons we do things this way are:</p>
<ul>
<li>It allows us to maintain more than one version of our API simultaneously.</li>
<li>Our code does not become convoluted having to keep track of which version of which resource is supposed to be represented at which time.</li>
</ul>
<p>Does this mean that for each increment of the [Revision] value we have a new installation of our API application that we install on the server and maintain?  Yes.  But when you think about this for a moment it&#8217;s not as bad as it sounds.  Let&#8217;s say that we again have version 1.4.7 of our API.  When we make a change requiring us to increment to version 1.4.8 we will no longer be making any changes to version 1.4.7.  It will sit on the server for whatever amount of time we desire to continue supporting its version.  When another change occurs, and we&#8217;re at version 1.4.9 of our API, we now have two old versions of the API that we no longer have to make changes to.</p>
<p>How long do you need to keep these old versions of the API lying around?  Only you can answer this question, but a decent rule of thumb would seem to be that whenever you increment the [Minor] value you would be safe to remove support for the previous versions.  Why you ask?  Because if you recall from earlier an increment to the [Minor] value is the result of a change in the way we interact with the REST resource.  If we have changed the overall structure of our resource, this seems like a good time to quit supporting previous versions of the structure.  Not only does this seem like a good idea, but it will also very likely be necessary.</p>
<p>Another reason this is not as bad as it seems is due to this question: How often are you making changes to your API?  Once you have put everything through its paces in development and have had the initial launch of your API how often are you going back to your data representation and adding a mobile phone, for example (and from our previous example)?  I ask this question in regards to continuously adding structure to your responses that arguably should have been present from the initial launch.  Now if you are feverishly adding new features and capabilities to your API then yes, this can become involved.  But how else are you going to maintain it?  Whether all the code is maintained in one installation of the application or segregated as I have described it is still code that has to be written.  I would rather be adding new API functionality to an isolated instance of the codebase than worry about having to maintain backwards compatibility.</p>
<h4>The 3rd tenet</h4>
<p>The usage of a REST APi is header-driven.   How you intend to interact with the data and business objects is conveyed in the use of GET, POST, PUT and DELETE headers.  If you need information about the API endpoints, you use OPTION, TRACE and/or ALLOW.  You define the format of your request using Content-Type and specify your desired result format using Accept.  But just like I don&#8217;t use custom HTTP headers because of concern that proxies may strip them off, how can I guarantee that headers in my response actually make it to the calling application, even if they are all standard and do not use custom headers?  Call me paranoid, but you can&#8217;t.  For that reason, I have a third tenet that I have followed in developing my REST API, which is:</p>
<ol start="3">
<li>Represent the headers in the response payload</li>
</ol>
<p>Before I show an example of what this looks like, let me provide another reason for taking this step.  I am a programmer.  As a programmer, I am sometimes developing something that will be consumed and other times I am developing something that is doing the consuming.  As the consumptive programmer, I very often run across a situation where I mumble under my breath at the decisions made by the developing programmer in how they arrived at the solution I am attempting to use.  Often it is not that more involved to take a few extra steps that will make the life of the consumptive programmer much easier.  This third tenant is one such easy extra step.  Even if you don&#8217;t completely agree with the need for this extra step, or have not yet ran across a situation where it is beneficial, what is really the cost of just doing it anyways?  I would proffer that the cost is negligible and that the goodwill earned from your consumptive programmers is worth the effort.</p>
<p>What it all boils down for me is this: I do not know how my API is going to be consumed.  Given that REST is a set of principles and not a specification I cannot guarantee that even with the best of intentions that the consuming application will be able to correctly interact with my response headers.  <i>Should</i> they be able to access them?  Yes.  Can they?  Who knows.  You don&#8217;t know if the consuming application is a server-side application written in C# or a browser-based application written in Javascript.  Maybe the language or platform the consuming application is written in/on has a limitation of some of the headers not being able to be accessed as desired.</p>
<p>So what does this look like?  Consider the following request and response examples:</p>
<p><strong>Request</strong></p>
<pre>
GET /v1.4.7/countries HTTP/1.1
Host: api.awesomesite.com
Accept: text/xml
</pre>
<p><strong>Response</strong></p>
<pre>
Status Code: 200 OK
Date: Wed, 16 Mar 2011 17:31:39 GMT
Vary: Accept
Content-Length: 432
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/xml

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;response&gt;
	&lt;countries&gt;
		&lt;country&gt;
			&lt;id&gt;1&lt;/id&gt;
			&lt;name&gt;United States of America&lt;/name&gt;
			&lt;regionCode&gt;US&lt;/regionCode&gt;
			&lt;callingPrefix&gt;011&lt;/callingPrefix&gt;
			&lt;callingCode&gt;1&lt;/callingCode&gt;
		&lt;/country&gt;
		&lt;country&gt;
			&lt;id&gt;2&lt;/id&gt;
			&lt;name&gt;Canada&lt;/name&gt;
			&lt;regionCode&gt;CA&lt;/regionCode&gt;
			&lt;callingPrefix&gt;011&lt;/callingPrefix&gt;
			&lt;callingCode&gt;1&lt;/callingCode&gt;
		&lt;/country&gt;
	&lt;/countries&gt;
&lt;/response&gt;
</pre>
<p>This is a typical GET request for a resource and the response you would normally receive as a result.  Following my third tenant of REST API implementation, you would want to modify your response so that instead it looks like this:</p>
<p><strong>Response</strong></p>
<pre>
Status Code: 200 OK
Date: Wed, 16 Mar 2011 17:31:39 GMT
Vary: Accept
Content-Length: 512
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: application/xml

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;response&gt;
	&lt;headers&gt;
		&lt;ResponseCode&gt;200&lt;/ResponseCode&gt;
		&lt;Vary&gt;Accept&lt;/Vary&gt;
	&lt;/headers&gt;
	&lt;countries&gt;
		&lt;country&gt;
			&lt;id&gt;1&lt;/id&gt;
			&lt;name&gt;United States of America&lt;/name&gt;
			&lt;regionCode&gt;US&lt;/regionCode&gt;
			&lt;callingPrefix&gt;011&lt;/callingPrefix&gt;
			&lt;callingCode&gt;1&lt;/callingCode&gt;
		&lt;/country&gt;
		&lt;country&gt;
			&lt;id&gt;2&lt;/id&gt;
			&lt;name&gt;Canada&lt;/name&gt;
			&lt;regionCode&gt;CA&lt;/regionCode&gt;
			&lt;callingPrefix&gt;011&lt;/callingPrefix&gt;
			&lt;callingCode&gt;1&lt;/callingCode&gt;
		&lt;/country&gt;
	&lt;/countries&gt;
&lt;/response&gt;
</pre>
<p>Notice that in this example I have included an additional &#8220;headers&#8221; node in my response.  This is not part of the &#8220;countries&#8221; node, therefore it&#8217;s inclusion or exclusion in the response body will not impact our data being properly represented.  What it has done though is ensure that in any situation in which response headers have gotten stripped, or a consuming application is not able to access them, that the header information is still represented.  Which headers you choose to include in this node is completely up to you.  I have elected to only include those that I deem the most important in maintaining RESTful communication.  Concepts and data such as Response Codes and Vary headers are integral parts of RESTful communication &#8211; the date and time of the response are not.  The reason I do not include the &#8216;Content-Type&#8217; header and value in the &#8220;headers&#8221; node is because this header is used to tell the consuming application what format the response body is in.  The consuming application will already have to know how to interpret the response in order to be told what format it is in, therefore it is information that is not needed (at the &#8220;headers&#8221; node level).</p>
<h4>Conclusion</h4>
<p>I hope that this post has gotten you thinking about some of the decisions you will have to make when developing your REST API and even if you don&#8217;t agree with the decisions I have made, you are at least now better prepared to face them.  The one thing to remember, above all else, is that REST is a set of principles and not a specification.  As long as you document your REST API and applications are capable of consuming it then no matter how you chose to implement it, it was the right way.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notmessenger.com/rest/3-tenets-for-implementing-a-rest-api/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>I will be presenting at the Dallas TechFest 2010 Conference</title>
		<link>http://www.notmessenger.com/php/i-will-be-presenting-at-the-dallas-techfest-2010-conference/</link>
		<comments>http://www.notmessenger.com/php/i-will-be-presenting-at-the-dallas-techfest-2010-conference/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 03:04:33 +0000</pubDate>
		<dc:creator>Jeremy Brown</dc:creator>
				<category><![CDATA[community]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[presentations]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://www.notmessenger.com/?p=124</guid>
		<description><![CDATA[I will be presenting a session titled "You can have it all! Zend Framework introduced into your current code" at the Dallas TechFest 2010 Conference.]]></description>
			<content:encoded><![CDATA[<p>I will be presenting a session titled &#8220;You can have it all! Zend Framework introduced into your current code&#8221; at the Dallas TechFest 2010 Conference.  The synopsis of the session is:</p>
<blockquote><p>Have you been reviewing all Zend Framework has to offer but aren&#8217;t sure how to integrate it with your existing code?  How can you begin taking advantage of Zend Framework without having to fully adopt the MVC architecture?  What do you do when you later want to being using MVC? Hint: You don&#8217;t have to throw away any of your code!  This session will present ideas and examples on how you can integrate Zend Framework alongside your existing code base with minimal need for future re-factoring.</p></blockquote>
<p>See all the details on the <a href="/presentations">Presentations</a> page.</p>
<p><strong>UPDATE (17 Aug 2010):</strong> Video and code examples have been added to the <a href="/presentations">Presentations</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notmessenger.com/php/i-will-be-presenting-at-the-dallas-techfest-2010-conference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework: Using Zend_Tool to Establish Your Project&#8217;s Skeleton</title>
		<link>http://www.notmessenger.com/php/zend-framework-using-zend_tool-to-establish-your-projects-skeleton/</link>
		<comments>http://www.notmessenger.com/php/zend-framework-using-zend_tool-to-establish-your-projects-skeleton/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 17:42:58 +0000</pubDate>
		<dc:creator>Jeremy Brown</dc:creator>
				<category><![CDATA[beginner]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[presentations]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://www.notmessenger.com/?p=110</guid>
		<description><![CDATA[I recently had the opportunity to give a presentation to the DFW Lamp User Group on Zend_Tool and how to use it to establish your project&#8217;s skeleton.  The presentation began by going into a very brief overview of Zend Framework itself, the basic structure of a Zend Framework application, and Zend_Tool&#8217;s place in it [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had the opportunity to give a presentation to the <a href="http://www.meetup.com/DFW-Apache-LAMP">DFW Lamp User Group</a> on Zend_Tool and how to use it to establish your project&#8217;s skeleton.  The presentation began by going into a very brief overview of Zend Framework itself, the basic structure of a Zend Framework application, and Zend_Tool&#8217;s place in it all.  I covered each of the components that make up the Zend_Tool ecosystem as well as how to install and use it on both Windows and *nix platforms.  Towards the end of the presentation I covered how to write your own custom providers and manifests and presented several ideas on where this newly-acquired knowledge could take you.</p>
<p>I have made the slides and corresponding code examples available for viewing and download on the <a href="http://www.notmessenger.com/presentations/">Presentations</a> page, as well as I recorded the presentation for you to be able to view as well.</p>
<p>I hope this information is useful, and happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notmessenger.com/php/zend-framework-using-zend_tool-to-establish-your-projects-skeleton/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>I have a blog – so now what?</title>
		<link>http://www.notmessenger.com/php/i-have-a-blog-%e2%80%93-so-now-what/</link>
		<comments>http://www.notmessenger.com/php/i-have-a-blog-%e2%80%93-so-now-what/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 08:20:29 +0000</pubDate>
		<dc:creator>Jeremy Brown</dc:creator>
				<category><![CDATA[beginner]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.notmessenger.com/?p=9</guid>
		<description><![CDATA[It does not matter what you are blogging about as long as you are blogging for you.  There is not one style that everyone should follow or any one way in which to "correctly" blog.  Just as each developer has their own style of coding (within the guidelines of best practices of course), they should also have their own style of blogging.  I had allowed myself to become consumed with how I thought my blog posts would be received to the point that I had not even created a single post to be shared.]]></description>
			<content:encoded><![CDATA[<p>This is my first blog post.</p>
<p>It’s amazing how long it took to write just these six words.  I do not mean that it took me an extended amount of time to literally write these six words, but instead am referring to the amount of time it has taken for me to begin blogging.  I first gave consideration to the idea of blogging approximately a year-and-a-half ago.  Then before I knew it almost that entire time period had passed me by without so much as a single sentence typed.  After attending the Dallas, TX stop of the CodeWorks 2009 tour on September 26 and 27, and meeting a venerable list of PHP’s who’s-who, I was once again inspired to begin blogging. <span id="more-9"></span> But then again, all of the activities of life once again seemingly got in the way.  My son had an ear surgery – there went a week.  My wife and I attended 30 hours of training to become foster parents – there went, well, 30 hours.  A project at work experienced issues – another week gone by.  When would I ever finally have time to begin blogging?</p>
<p>I am going to diverge from the previous train of thought for just a moment, but I promise that I will come back around to it in just a moment.  I have owned two moderately successful businesses in my past, with one of them having actual real employees who oddly enough required actual real cash dollars every payday.  The reason I share this is to say that I am an individual who is not unaccustomed to challenges.  In other previous employment endeavors I have been an instructor, both in commercial and educational settings.  The reason I share this is to say that I am an individual who is not intimidated by being a resource of knowledge for others. I have been developing with PHP since early 1999 and am a Zend Certified Engineer.  The reason I share this is to say that while I am always continuously learning, like all good developers should be, I’ve got solid grasp on the ins and outs of web application development using PHP.</p>
<p>Now here’s where I get both of these trains of thought back together on the same track.  Despite having previously faced challenges and enjoy continuously doing so, despite being able to command a classroom with my leadership and despite being an experienced PHP developer that currently leads a team of developers, there is something daunting and somewhat terrifying about the prospect of blogging.  It is one thing to start playing with a new piece of technology or software in the privacy of your own office, to implement the tried-and-true &#8220;Hello World&#8221;, where no one will be aware of how many iterations you had to suffer through before getting right, and it is quite another to do so in full view of the rest of the PHP community and the glaring lights of the not-so-private internet.  Please do not misunderstand me.  I am not for one moment saying that the PHP community is not one that will welcome a newcomer of any caliber, contributing in any capacity, into its fold.  Quite the opposite actually – the PHP community is extremely welcoming with many tremendous members.  But what I am saying is that it’s one thing to be judged only by yourself and another to subject yourself to judgment by a multitude of others.</p>
<p>During the five weeks since CodeWorks, when I decided (again) that I was going to begin blogging, I have been going around and around in my head about what my first blog post should be about.  I have had several ideas, but was quick to dismiss them as being to ambitious or needing more time that I had at the moment to devote.  I finally realized that these were just excuses. The same types of excuses that had kept me from blogging for the past year and more.  I was then reminded of two different blog posts I had recently read that spoke, to me, on this subject.  While at CodeWorks I had the honor of meeting Chris Cornutt.  You should follow him on Twitter: <a href="http://twitter.com/enygma" target="_new"> http://twitter.com/enygma</a>.  It was two of his blog posts, titled &#8220;The Beginner Pattern&#8221; (read it here: <a href="http://blog.phpdeveloper.org/?p=198" target="_new"> http://blog.phpdeveloper.org/?p=198</a>) and &#8220;Mom Always Said to Share&#8221; (read it here: <a href="http://blog.phpdeveloper.org/?p=169" target="_new">http://blog.phpdeveloper.org/?p=169</a> that I kept coming back to. Here is what I took from these posts: it does not matter what you are blogging about as long as you are blogging for you.  There is not one style that everyone should follow or any one way in which to &#8220;correctly&#8221; blog.  Just as each developer has their own style of coding (within the guidelines of best practices of course), they should also have their own style of blogging.  I had allowed myself to become consumed with how I thought my blog posts would be received to the point that I had not even created a single post to be shared.  Now I know these exact words are not in either of his posts, and perhaps this exact interpretation was never intended, but this again speaks to my point.  Every reader will get something different from my blog posts.  It is only my responsibility to be true to myself.</p>
<p>So there it is – my first blog post.  What started out as a difficult first six words to write has now turned into over 900 words and counting.  For those of you who have stuck with me this whole time and are still reading, I sincerely thank you.  If you are an already-established member of the PHP community, likely already with your own blog, I thank you for welcoming me further into the PHP community.  If you are someone just starting out I strongly encourage you to jump in with both feet and never look back.  As for future posts, I am certain there will be one about my first-time experiences contributing to the Zend Framework, for while I do have a Contributer Licensing Agreement (CLA) on file with Zend, I have somehow always seemed to find something to keep me from ever actually getting around to contributing.  As Chris Cornutt says in his post, &#8220;Don’t be afraid to put you and your code out there!&#8221;</p>
<p>I am now off to shamelessly promote my first post!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.notmessenger.com/php/i-have-a-blog-%e2%80%93-so-now-what/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

