title: Using ONS API for Electoral Ward & Constituency
body: <p>Need the functionality on a site I'm making to get a user's electoral ward &amp; constituency from a UK postcode which has been entered.</p>
  
  <p>I have been using <a href="https://www.uk-postcodes.com/" rel="nofollow noreferrer">https://www.uk-postcodes.com/</a> where you'd make a simple file_get_contents() call like <a href="https://www.uk-postcodes.com/postcode/" rel="nofollow noreferrer">https://www.uk-postcodes.com/postcode/</a><em>postcode</em>.json but that site has recently gone down (CloudFlare Bad Gateway) - which I always knew was a risk of using an external service, but I took it anyway.</p>
  
  <p>How can I get this same information directly from the ONS website? I honestly can't find anything related to this at all, never mind where to make this call.</p>
  
  <p>One thing to note: I don't want to have to include a whole library for this. I'd prefer a much more minimalistic approach to this.</p>
  
  <p>I'd be very grateful for any advice or help on this.</p>