<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[PMB Digital - Medium]]></title>
        <description><![CDATA[Posts (mostly about technology) from the digital team at Primedia Broadcasting - Medium]]></description>
        <link>https://medium.com/pmb-digital?source=rss----5f8d58cf6f99---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>PMB Digital - Medium</title>
            <link>https://medium.com/pmb-digital?source=rss----5f8d58cf6f99---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 20:06:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/pmb-digital" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Configuring a Raspberry Pi as an always-on dashboard]]></title>
            <link>https://medium.com/pmb-digital/configuring-a-raspberry-pi-as-an-always-on-dashboard-dd734a7c7eb0?source=rss----5f8d58cf6f99---4</link>
            <guid isPermaLink="false">https://medium.com/p/dd734a7c7eb0</guid>
            <dc:creator><![CDATA[Allan Kent]]></dc:creator>
            <pubDate>Fri, 17 Oct 2014 14:44:35 GMT</pubDate>
            <atom:updated>2014-10-17T14:44:35.249Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VZj48FaqRvMwUqE68kyBow.jpeg" /></figure><p>The Raspberry Pi makes for an excellent and cheap PC to hook up to an HDMI screen as a dashboard. However, when setting it up there are a couple of things you can do to make your life easier. This is a collection of tips that I gathered from around the Interwebs as I went through the process of setting one up for my office so that it booted up directly into the dashboard without any intervention from my part (besides adding power)</p><h4>Boot to Desktop</h4><p>Assuming you don’t want to monitor an ncurses based application in a terminal, you’ll probably want a web browser. Set up the Pi to boot directly into Desktop mode:</p><pre>sudo raspi-config</pre><h4>Protect your proxy authentication details</h4><p>If like me, you work on a corporate network, there’s a good chance you’ll have a proxy server of some kind that you need to authenticate to. Leaving your login details lying about in a plain text file or environment variable is never a good idea, so use <a href="http://cntlm.sourceforge.net/">Cntlm</a> to protect them.</p><p>To install Cntlm you’ll need to use your corporate proxy server initially, so create the environment variable:</p><pre>export http_proxy=http://loginname:password@yourproxy:8080</pre><p>(it will be cleared when you next reboot, so just remember to do that)</p><p>Then, install Cntlm:</p><pre>sudo apt-get install cntlm</pre><p>Once Cntlm is installed, edit the config file at <em>/etc/cntlm.conf</em> and update the <em>Username</em>, <em>Domain</em> and <em>Proxy</em> settings:</p><pre>Username       yourlogin<br>Domain         yourdomain<br>Proxy          yourcorporateproxy:8080</pre><p>Save the file, exit to the shell and run cntlm to generate the keys that you need:</p><pre>sudo cntlm -v -H -c /etc/cntlm.conf</pre><p>You’ll be prompted for your proxy server password, enter that and Cntlm will return three encrypted keys. The three lines are <em>PassLM</em>, <em>PassNT</em> and <em>PassNTLMv2</em>, each followed by a 32 character string. Copy these three lines and paste them into your cntlm.conf file. You can now restart Cntlm:</p><pre>sudo service restart cntlm</pre><p>To configure the proxy server settings for the shell, edit the <em>/etc/environment</em> file and add this line:</p><pre>export http_proxy=http://127.0.0.1:3128</pre><p>You can now configure <em>apt</em> to use this proxy server — edit the <em>/etc/apt/apt.conf.d/10proxy</em> file and add this line:</p><pre>Acquire::http::proxy “http://127.0.0.1:3128/&quot;;</pre><p>You can now use <a href="http://127.0.0.1:3128/">http://127.0.0.1:3128</a> as your proxy server in all applications and Cntlm will proxy the authenticated requests for you.</p><h4>Loading Chromium at startup in kiosk mode</h4><p>If you’re displaying a dashboard of some kind, chances are you’ve built it as a web application. Using <a href="http://www.chromium.org/Home">Chromium</a> in Kiosk mode will give you the latest browser support. First, install Chromium:</p><pre>sudo apt-get install chromium</pre><p>Then, edit the <em>/etc/xdg/lxsession/LXDE/autostart</em> file and add the following line:</p><pre>@chromium —-proxy-server=127.0.0.1:3128 —-kiosk <a href="http://yourapp/">http://yourapp</a></pre><h4>Disabling screen blank</h4><p>Since this is a dashboard screen (and won’t have a keyboard and mouse attached) you need to make sure that the screen doesn’t blank due to inactivity. First install these utils:</p><pre>sudo apt-get install unclutter x11-xserver-utils</pre><p>Then, again edit the <em>/etc/xdg/lxsession/LXDE/autostart</em> file and add the following lines:</p><pre>@xset s off<br>@xset -dpms<br>@xset s noblank</pre><p>If your autostart file has a line for the screen saver, comment it out.</p><h4>Removing the Session Restore prompt</h4><p>At some point you’ll lose power to the Pi, and when it boots back up Chromium will pop a helpful message at the top of the screen about an unsafe shutdown and offering to restore your session. With no mouse attached this can be pretty annoying.</p><p>Add the following to you .profile to help Chromium forget that you didn’t shut down correctly:</p><pre>sed -i &#39;s/\(&quot;exited_cleanly&quot;: *\)false,/\1true,/&#39; .config/chromium/Default/Preferences</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd734a7c7eb0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pmb-digital/configuring-a-raspberry-pi-as-an-always-on-dashboard-dd734a7c7eb0">Configuring a Raspberry Pi as an always-on dashboard</a> was originally published in <a href="https://medium.com/pmb-digital">PMB Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting free tools to solve business challenges]]></title>
            <link>https://medium.com/pmb-digital/connecting-free-tools-to-solve-business-challenges-704df5257606?source=rss----5f8d58cf6f99---4</link>
            <guid isPermaLink="false">https://medium.com/p/704df5257606</guid>
            <dc:creator><![CDATA[Allan Kent]]></dc:creator>
            <pubDate>Sun, 20 Jul 2014 11:56:40 GMT</pubDate>
            <atom:updated>2014-07-20T11:57:30.389Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*kaq-ZEKXc5i97yBRljF5Sg.jpeg" /></figure><h4>Or, how we built an intuitive CMS for our in-studio screens on the cheap</h4><p>Anyone who’s worked with me knows that I’ll look to unix whenever there’s a challenge to be solved. And this is not because I’m an impartial unix zealot (OK maybe just a bit), but because I love the way that it provides a host of very specific tools that can be chained together in ways only limited (for the most part) by your imagination.</p><p>And so it was this approach that we took when trying to solve our latest challenge — how do we let people quickly and easily update the in-studio screens, when they are pressed for time and on the move? The brief was something like this:</p><blockquote>A guest arrives on short notice and we need the producers to be able to take a photo and get it onto the screens — if they could just email it somewhere and have it appear, that would be great.</blockquote><p>This makes complete sense. We could easily have built a small CMS for uploading the images and guest details, but that would require the producers to take the photo, open the CMS on their phone (or get the photo off their phone) and upload. These are people who don’t have time for such luxuries, and so simply being able to send an email somewhere and have the rest “just happen” would be the path of least resistance.</p><p>For the first part of the puzzle we turned to <a href="https://postmarkapp.com/">https://postmarkapp.com</a> — this is great service for handling email delivery from your apps, but the feature that makes it most attractive for this task is the <a href="https://postmarkapp.com/inbound">inbound mail processing</a>. With this feature you get a unique email address to which you can bind a webhook — any mail that arrives on that email address gets parsed, and the data POST’ed to the webhook endpoint of your choice. You start with 10 000 credits and once you’ve run out, 1000 credits will cost you $1.50, so it’s not going to break the bank.</p><p>For the hosting of the webhook, <a href="https://www.heroku.com/">Heroku</a> works perfectly. The first endpoint to create is the one that <a href="http://postmarkapp.com/">http://postmarkapp.com</a> hits when mail arrives. Here’s a very simplified code snippet from my Sinatra app:</p><pre> post ‘/maildump’ do<br>   body = JSON::parse(request.body.read) <br>   subject = body[“Subject”]<br>   textbody = body[“TextBody”]<br>   body[“Attachments”].each do |attached|<br>     name = attached[“Name”]<br>     attachment = Base64.decode64(attached[“Content”])<br>   end<br>   status 200<br> end</pre><p>Basically, parse the JSON request body, extract the subject and email body, then loop through each of the attachments, decoding the base64 encoded attachment as you go. Our live code has some logic that strips out our business signatures as we don’t want that coming up on the screens. You can check out the <a href="http://developer.postmarkapp.com/developer-inbound-parse.html">Postmark developer documentation</a> for the full details of what gets delivered in the JSON payload.</p><p>The next question is what to do with the data once it arrives? Initially we were just saving the attachment and storing the data in a database, but what if they made a typo, or want to be able to go back to a previous image? Building an admin interface for this seemed like a bit of overkill, so for this we turned to <a href="https://trello.com/">Trello</a>. For a free service, Trello is amazing — we use it for organising everything from our personal to-do lists through to large projects, and it has a full API as well. So why not use it to store the info we want to display on the screens?</p><p>I created a new board with two lists: Live and Archive. I’ll use the Live list for card(s) that I want to appear on the screen and the Archive list for keeping the old cards in case I want to reuse them.</p><p>To access the board you’ll need two things: a developer key and a user token. To get a developer key, log in to Trello and then visit this URL:</p><p><a href="https://trello.com/1/appKey/generate">https://trello.com/1/appKey/generate</a></p><p>When you have the key, plug it into this URL to get the token:</p><p>https://trello.com/1/connect?key=<strong>yourdeveloperkey</strong>&amp;name=<strong>YourAppName</strong>&amp;response_type=token&amp;expiration=never&amp;scope=read,write</p><p>If you only need read access, just remove <strong><em>,write</em></strong> from the scope in the URL, but since I want to push content into the board, I need read and write access.</p><p>One other thing you’ll need to grab for your code is the ID for the Live list that you want to add the card to. The Board ID you can get from the URL when you visit that Board, then plug it into this API call to get the ID’s of the Lists in that board:</p><p>https://api.trello.com/1/boards/<strong>yourboardid</strong>/lists?key=<strong>yourkey</strong>&amp;token=<strong>yourtoken</strong></p><p>Here’s my /maildump endpoint code again, but this time including the code to store the info in Trello:</p><pre>post ‘/maildump’ do<br>  body = JSON::parse(request.body.read) <br>  subject = body[“Subject”]<br>  textbody = body[“TextBody”]<br>  auth_params = {<br>   :key =&gt; ‘<strong>yourdeveloperkeyhere</strong>’,<br>   :token =&gt; ‘<strong>yourusertokenhere</strong>’<br>  }<br>  post_params = auth_params<br>  post_params[:idList] = ‘<strong>yourlistidgoeshere</strong>’<br>  post_params[:name] = subject<br>  post_params[:desc] = textbody<br>  post_params[:pos] = ‘top’<br>  response = Unirest.post “https://api.trello.com/1/cards&quot;,<br>    headers:{“Accept” =&gt; “application/json”},<br>    parameters: post_params<br>  card = response.body[“id”]<br>  body[“Attachments”].each do |attached|<br>    name = attached[“Name”]<br>    attachment = Base64.decode64(attached[“Content”])<br>    tfile = File.open(‘./tmp/attached.jpg’, ‘w’)<br>    tfile.write(attachment)<br>    tfile.close<br>    file = File.open(“./tmp/attached.jpg”, &#39;r&#39;)<br>    attach_params = auth_params<br>    attach_params[:file] = file<br>    attach_params[:name] = name<br>    response = Unirest.post “https://api.trello.com/1/cards/# {card}/attachments&quot;,<br>      headers:{“Accept” =&gt; “application/json”},<br>      parameters: attach_params<br>  end<br>  status 200<br>end</pre><p>As you can see, we create the new card, setting the pos to top, so that it is first in the list. Th excellent <a href="http://unirest.io/">http://unirest.io</a> library makes this simple. Once the card is created, we attach any email attachments to the newly created card. That code is a bit of a mess — when making the API call for uploading the attachment, you need to pass in a File handle to a file opened for reading, so you have to first write the temp file, close it, and then open it for reading. If anyone knows of a more elegant way to do this, please let me know — I tried a couple of permutations with in-memory files but the attachment always ended up as corrupted on Trello.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*yL1qqVAFb04O-e2X33_5lQ.gif" /><figcaption>The email arriving as a card in Trello</figcaption></figure><p>Because Trello shows you real time updates, you can actually watch the card pitch up in Trello just after you send it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*HsMqyQk8UT-HjmdG4P8FtA.jpeg" /><figcaption>The card detail</figcaption></figure><p>The eagle-eyed amongst you will point out that Trello provides an email address for creating cards — we did try this, but there was a significant delay between sending the email and it arriving in Trello. We also wanted to be able to control the structure of the card (and do some text wrangling first) so while it was a bit more work, the Postmark/Heroku combo worked better for us.</p><p>The last piece of the puzzle is to get the info out of Trello, and of course there’s an API for this:</p><pre>get ‘/screen.json’ do<br>  content_type :json<br>  response[‘Access-Control-Allow-Origin’] = ‘*’<br>  auth_params = {<br>    :key =&gt; ‘<strong>yourdeveloperkeyhere</strong>’,<br>    :token =&gt; ‘<strong>yourusertokenhere</strong>’<br>  }<br>  query_params = auth_params<br>  query_params[:fields] = ‘name,desc’<br>  query_params[:attachments] = ‘true’<br>  query_params[:attachment_fields] = ‘url’<br>  query_params[:limit] = 1<br>  resp = Unirest.get “https://api.trello.com/1/lists/<strong>yourlisidgoeshere</strong>/cards&quot;,<br>    headers:{ “Accept” =&gt; “application/json” },<br>    parameters: query_params<br>  { :subject =&gt; resp.body.first[“name”], :body =&gt; resp.body.first[“desc”], :image =&gt; resp.body.first[“attachments”].first[“url”] }.to_json<br>end</pre><p>This will return the first card from the list in JSON format:</p><pre>{<br> &quot;subject&quot;: &quot;Another test&quot;,<br> &quot;body&quot;: &quot;Here we go!\r\n&quot;,<br> &quot;image&quot;: &quot;https://trello-attachments.s3.amazonaws.com/.../attached.jpg&quot;<br>}</pre><p>The data that this endpoint provides is then used with some <a href="http://handlebarsjs.com/">Handlebars magic</a> to create the display for the screens. We’ve now got a very simple pipeline of (almost) free tools that deliver ease of use to the producers (send an email) as well as some control when required (open Trello and edit).</p><p>There’s still some work to be done:</p><ul><li>error checking would be handy ☺</li><li>having the display cycle through all of the cards in the Live list, rather than just showing one (if required)</li><li>setting up some WebSockets (or properly investigating the functionality that <a href="https://trello.com/docs/gettingstarted/clientjs.html">Client.js</a> provides) so that we can push changes to the displays</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=704df5257606" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pmb-digital/connecting-free-tools-to-solve-business-challenges-704df5257606">Connecting free tools to solve business challenges</a> was originally published in <a href="https://medium.com/pmb-digital">PMB Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up ApiAxle]]></title>
            <link>https://medium.com/pmb-digital/setting-up-apiaxle-33e50d17e887?source=rss----5f8d58cf6f99---4</link>
            <guid isPermaLink="false">https://medium.com/p/33e50d17e887</guid>
            <dc:creator><![CDATA[Allan Kent]]></dc:creator>
            <pubDate>Mon, 07 Jul 2014 20:31:35 GMT</pubDate>
            <atom:updated>2014-07-07T20:18:21.869Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/desat/multiply/blue/60/overlay/blue/1*MNyFiSDdfxHlSN2mkazm0w.jpeg" /></figure><h4>The one with the subdomains and URL rewriting</h4><p>I’m busy playing with <a href="http://apiaxle.com/">ApiAxle</a> at the moment, as a way of exposing our internally facing API endpoints to customers and partners.</p><p>The <a href="http://apiaxle.com/docs/try-it-now/">documentation</a> is really good, but the part that had me puzzled for a while was connecting the endpoint you want exposed externally, with the internal endpoint of your API. This is quite probably down to me not thinking it through properly, but in case someone else is struggling with the same issue, here it is.</p><p>First, get it all up and running by following the ApiAxle documentation for installing node, redis and the 3 ApiAxle programs.</p><p>There are 4 parts that you need to connect together:</p><ul><li>The ApiAxle proxy tool running and configured to handle the incoming requests passed to it by nginx</li><li>A local hostname mapping for each of the API endpoints you want to expose</li><li>nginx to listen for the incoming external requests, potentially rewrite them and pass them on the the ApiAxle proxy</li><li>The destination endpoint API</li></ul><p>For the purpose of this write up I’m going to use a vagrant hosted ApiAxle installation to proxy API requests through to Reddit. Specifically, the endpoint for <a href="http://www.reddit.com/r/nottheonion/top">http://www.reddit.com/r/nottheonion/top</a> that you get by hitting <a href="http://www.reddit.com/r/nottheonion/top.json">http://www.reddit.com/r/nottheonion/top.json</a>. We’ll set up our local machine to listen on <a href="http://localhost/api/reddit/nottheonion/top.json">http://localhost/api/reddit/nottheonion/top.json</a>, rewrite the request and pass it through to Reddit.</p><p>If you’re using Vagrant, make sure that you are proxying requests to your local machine through to port 80 on the vagrant box:</p><pre>config.vm.network :forwarded_port, guest: 80, host: 8000</pre><p>Then, install nginx (to handle the incoming web requests) and supervisor (to manage the apiaxle-proxy instances)</p><pre>sudo apt-get install nginx supervisor</pre><p>Once that is done, change to /etc/supervisor/conf.d and create a new file called apiaxle-proxy.conf:</p><pre>[program:apiaxle-proxy]<br>process_name = apiaxle-proxy-%(process_num)s<br>command = apiaxle-proxy -f 1 -p %(process_num)s<br>numprocs = 4<br>numprocs_start = 3000<br>redirect_stderr=true<br>stdout_logfile=/var/log/apiaxle-proxy-%(process_num)s-stdout.log<br>stderr_logfile=/var/log/apiaxle-proxy-%(process_num)s-stderr.log</pre><p>This will kick off 4 copies of the apiaxle-proxy application, listening on ports 3000, 3001, 3002 and 3003</p><p>vagrant@precise64:~$ sudo service supervisor start<br>Starting supervisor: supervisord.</p><p>which can be verified by looking at the process list:</p><pre>r/conf.d$ ps ax | grep apiaxle<br> 8247 ? Sl 0:17 node /usr/bin/apiaxle-proxy -f 1 -p 3001<br> 8252 ? Sl 0:17 node /usr/bin/apiaxle-proxy -f 1 -p 3000<br> 8253 ? Sl 0:16 node /usr/bin/apiaxle-proxy -f 1 -p 3003<br> 8256 ? Sl 0:16 node /usr/bin/apiaxle-proxy -f 1 -p 3002<br> 8260 ? Sl 0:30 /usr/bin/nodejs /usr/bin/apiaxle-proxy -f 1 -p 3001<br> 8261 ? Sl 0:29 /usr/bin/nodejs /usr/bin/apiaxle-proxy -f 1 -p 3002<br> 8262 ? Sl 0:30 /usr/bin/nodejs /usr/bin/apiaxle-proxy -f 1 -p 3003<br> 8266 ? Sl 0:30 /usr/bin/nodejs /usr/bin/apiaxle-proxy -f 1 -p 3000</pre><p>Next we need to set up a local hostname for the API. ApiAxle uses subdomains to segment different proxies API’s, so edit /etc/hosts and add:</p><pre>127.0.0.1 reddit.api.localhost</pre><p>Now, if we hit <a href="http://localhost:3000/">http://localhost:3000</a> we get:</p><pre>{“meta”:{“version”:1,”status_code”:404},”results”:{“error”:{“type”:”ApiUnknown”,”message”:”No api specified (via subdomain)”}}}</pre><p>and if we hit <a href="http://reddit.api.localhost:3000/">http://reddit.api.localhost:3000</a> we get:</p><pre>{“meta”:{“version”:1,”status_code”:404},”results”:{“error”:{“type”:”ApiUnknown”,”message”:”’reddit’ is not known to us.”}}}</pre><p>So, ApiAxle is taking the subdomain prefix before .api.localhost and using that to select an API to proxy. The error message that we are getting is because that proxy hasn’t yet been set up. To do that we need to configure the ApiAxle proxy tool. Open up the REPL command apiaxle:</p><pre>axle&gt; api “reddit” create endPoint=”<a href="http://www.reddit.com/">www.reddit.com</a>&quot;</pre><p>Then create a key for the API authentication and link it to the new API you just created:</p><pre>axle&gt; key “9876&quot; create<br>axle&gt; api reddit linkkey “9876&quot;</pre><p>Now, if you were to visit <a href="http://reddit.api.localhost:3000/?api_key=9876">http://reddit.api.localhost:3000?api_key=9876</a> ApiAxle will simply forward that request on to <a href="http://www.reddit.com/">http://www.reddit.com</a> — which at this point isn’t terribly helpful (for our purposes)</p><p>The last piece of the puzzle is to set up nginx to listen for the external incoming requests, rewrite the URL and pass it on the ApiAxle.</p><p>Open /etc/nginx/sites-available/default and add the following:</p><pre>upstream apiaxle {<br> server 127.0.0.1:3000;<br> server 127.0.0.1:3001;<br> server 127.0.0.1:3002;<br> server 127.0.0.1:3003;<br>}</pre><p>This defines the upstream cluster of ApiAxle proxy instances. Then, under the server, the specific location that you want to listen on for proxying this API:</p><pre> location /api/reddit/ {<br>   rewrite /api/reddit/(.*) /r/$1 break;<br>   proxy_pass <a href="http://apiaxle/">http://apiaxle</a>;<br>   proxy_set_header Host “reddit.api.localhost”;<br> }</pre><p>We’re listening on /api/reddit/ and then rewriting the URL to /r/ — anything after /api/reddit — the (.*) is put on to the end of /r/ (the $1).</p><p>This is useful since then you can map your own API structure (for managing multiple API endpoints) to whatever the remote API endpoint looks like.</p><p>Restart nginx to make the changes take effect:</p><pre>sudo service nginx restart</pre><p>To test the nginx upstream config, try connect to:</p><pre>curl <a href="http://localhost/api/reddit/nottheonion/top.json?api_key=9876">http://localhost/api/reddit/nottheonion/top.json?api_key=9876</a></pre><p>This should hit:</p><ul><li>nginx on port 80</li><li>match the /api/reddit/ Location block</li><li>rewrite /api/reddit/nottheonion/top.json to /r/nottheonion/top.json</li><li>Add the reddit.api.localhost Header</li><li>Pass the request on to the upstream server (ApiAxle)</li></ul><p>If it’s all working correctly you should see the JSON returned from reddit.com</p><p>Since vagrant is listening on port 8000 on my local machine proxying requests through to port 80 (nginx) on the vagrant box, I should be able to hit <a href="http://localhost:8000/api/reddit/nottheonion/top.json?api_key=9876">http://localhost:8000/api/reddit/nottheonion/top.json?api_key=9876</a> on my local machine and get the response from Reddit:</p><pre>{<br> &quot;kind&quot;: &quot;Listing&quot;,<br> &quot;data&quot;: {<br> &quot;modhash&quot;: &quot;&quot;,<br> &quot;children&quot;: [<br> {<br> &quot;kind&quot;: &quot;t3&quot;,<br> &quot;data&quot;: {<br> &quot;domain&quot;: &quot;washingtonpost.com&quot;,<br> &quot;banned_by&quot;: null,<br> &quot;media_embed&quot;: {},<br> &quot;subreddit&quot;: &quot;nottheonion&quot;,<br> &quot;selftext_html&quot;: null,<br> &quot;selftext&quot;: &quot;&quot;,<br> &quot;likes&quot;: null,<br> &quot;secure_media&quot;: null,<br> &quot;link_flair_text&quot;: null,<br> &quot;id&quot;: &quot;2a1g6d&quot;,<br> &quot;gilded&quot;: 0,<br> &quot;secure_media_embed&quot;: {},<br> &quot;clicked&quot;: false,<br> &quot;stickied&quot;: false,<br> &quot;author&quot;: &quot;CarbonNitrogen&quot;,<br> &quot;media&quot;: null,<br> &quot;score&quot;: 1256,<br> &quot;approved_by&quot;: null,<br> &quot;over_18&quot;: false,<br> &quot;hidden&quot;: false,</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33e50d17e887" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pmb-digital/setting-up-apiaxle-33e50d17e887">Setting up ApiAxle</a> was originally published in <a href="https://medium.com/pmb-digital">PMB Digital</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>