4 years ago

400 Bad Request

Posted 4 years ago by theFinalArbiter

Im using guzzle to send a POST to a REST API. I reached a point where I don't know how to debug it. I get a 400 response. It never seems to reach the server, as there is no POST item in the network tab. This is the response catched in the try clause.

  -response: Response {#199 ▶}
  #message: "Client error response [url] [status code] 400 [reason phrase] Bad Request"
  #code: 400

I have not been able to find out what about the request causing it. Default client object:

        $this->FMEServerClient = new GuzzleHttp\Client([
            'base_url' => env('FME_Server_url'),
            'defaults' => [
                'headers' => [
                    'Authorization' => 'fmetoken token=' . env('FME_Server_API_TOKEN'),
                    'Accept' => 'application/json',
                    'content-type' => 'application/json'
                'verify' => false                

This is how i use it:

$url = '/fmerest/v2/transformations/commands/transact/myrepo/scrapegeom.fmw?detail=low'
try {
    $result = $this->FMEServerClient->post($url);
 } catch (RequestException $e) {
} catch (\Exception $e) {
    // There was another exception.

Its catched by \Exception, where I searched but found no clue what Bad Request actually means. Any ideas how I should proceed?

Please sign in or create an account to participate in this conversation.