400 Error on API endpoint in Guzzle that works fine in Browser & Postman
<p>I am trying to access the following public API resource:</p>

<p><a href="http://www.nomisweb.co.uk/api/v01/dataset/NM_17_5.data.json?geography=1946157081,943718401...943718512,2092957698&amp;date=latest&amp;variable=18&amp;measures=20599,21001,21002,21003" rel="nofollow">http://www.nomisweb.co.uk/api/v01/dataset/NM_17_5.data.json?geography=1946157081,943718401...943718512,2092957698&amp;date=latest&amp;variable=18&amp;measures=20599,21001,21002,21003</a></p>

<p>When I try it in the browser, it downloads as a JSON file. When I try it in Postman, it shows as text (JSON format).</p>

<p>When I try it in Guzzle, I get a 400 error.</p>

<pre><code>$apiResource = "http://www.nomisweb.co.uk/api/v01/dataset/NM_17_5.data.json?geography=1946157081,943718401...943718512,2092957698&amp;date=latest&amp;variable=18&amp;measures=20599,21001,21002,21003";

try {
    $client = new Client();
    $res = $client-&gt;request('GET', $apiResource);
} 
catch (\GuzzleHttp\Exception\BadResponseException $e) {
    die($e-&gt;getMessage());
} 
</code></pre>

<p>I suspect the problem is something to do with the API returning the </p>

<pre><code>Content-Disposition attachment
</code></pre>

<p>In the header, but I don't know what the correct way for Guzzle to handle this is. </p>

<p>Just to be clear, I want to get the raw text output and not the file as an attachment.</p>