RESTful API Client Interactions
<p>So I am writing an API, and I am fearful that the code I am writing is going to become messy very quickly.</p>

<p>Some pages I need to be fetching data from several different resources from the API, and I am ending up with a whole bunch of try and catch statements everywhere. For example:</p>

<pre><code>$topic_id = 100;
try
{
    $topic = AwesomeAPI::get('topics/' . $topic_id);
    $parts = AwesomeAPI::get('parts?topic_id=' . $topic_id);
    try
    {
        // Get another resource here
    }
    catch (Exception $e)
    {
        // Error
    }
}
catch (Exception $e)
{
    return Response::error('404');
}
</code></pre>

<p>I am confident that this code is quite messy, and it gets even worse if I have to loop through a resource and grab another resource in the loop. Yuck.</p>

<p>I am wondering how to best approach client interactions with an API in a neat fashion.</p>
