# XML to JSON API Proxy for Quick Mash-Ups
> While building our company dashboard, which was mentioned in our previous blog post on SVG with Raphael, I came across a problem with the project management tool we use – Pivotal Tracker. The Pivotal Tracker API is only in XML, which means you can’t do…
Author: Matthew Ford
Published: 2011-05-25

<p>While building our company dashboard, which was mentioned in our previous blog post on <a href="/blog/2010/04/svg-images-and-animations-on-the-web-with-raphael/">SVG with Raphael</a>, I came across a problem with the project management tool we use – Pivotal Tracker.</p><p>The Pivotal Tracker API is only in XML, which means you can’t do cross-domain requests and access the API via javascript. This meant that if I wanted to extract data about the status of our user stories, I would have to do it on the server side. As everything so far had been done with javascript on the client side, I was reluctant to start making things more complicated.</p><p>I contacted Pivotal, who said they might <a href="https://community.pivotaltracker.com/pivotal/topics/api_jsonp_response">think about adding JSON at some point</a>, but I didn’t want to wait for them to sort it out. Instead, I built a quick API proxy that allows you to make a request to a XML API and get back JSON. So, now, I can do this in my javascript:</p><p>$.ajax({ type: "GET", url: 'https://xml2json.heroku.com', data:'url=https://www.pivotaltracker.com/services/v3/projects/'+projectId+'/iterations/current?token='+trackerToken, dataType: 'jsonp', success: function(data) { console.log(data); } });</p><p>It will proxy the GET request to the API and convert the XML response into JSON, via <a href="https://xml2json.heroku.com/">https://xml2json.heroku.com</a> (supports JSONP). I’ve put the code on GitHub <a href="https://github.com/bitzesty/xml2jsonp">https://github.com/bitzesty/xml2jsonp</a> in case anyone else needs to do the same thing.</p>
