NULL 'location' response - All Endpoints (Critical)


(Dominic Morrocco) #1

On November 9th, the Dwolla API stopped returning an array as $response and started returning a string. Because the API is returning a sting, there are no responses received from the Dwolla API. As a paid enterprise customer, I’ve had an open, unresolved ticket open with Dwolla since the 9th of November. I’m hoping I can find some assistance with the community as this appears to have occurred with other user accounts as well.

MY CODE:

// make the api call
DwollaSwagger\Configuration::$access_token = $token;
$apiClient = new DwollaSwagger\ApiClient($api_url);

$customersApi = new DwollaSwagger\CustomersApi($apiClient);

$customer = $customersApi->create([
‘firstName’ => ‘Api’,
‘lastName’ => ‘Test’,
‘email’ => ‘apitestss@msqrealty.com’,
‘ipAddress’ => $ip,
‘type’ => ‘receive-only’
]);

    echo $customer;  // <-- THIS IS EMPTY / NULL

}

DWOLLA SWAGGER CODE

// make the API Call
$response = $this->apiClient->callAPI($resourcePath, $method,
$queryParams, $httpBody,
$headerParams, $this->authSettings);
if(!$response[1]) {
return null;
}
return $response[0] == 201 ? $response[1] : $this->apiClient->deserialize($response[1],‘Unit’);

EXPLANATION

In my code, ‘$customer’ is NULL. It’s NULL because in Dwolla’s code ‘$response’ is an ARRAY, but in reality, ‘$response’ is a string, and the string is ‘201’. There is no array. Dwolla can’t provide be with a a location for -ANY- api response because it’s always a string, never an array.

I’m unaware of anything on my end which would cause the ‘$response’ array to be returned as a string, but this is always a possibility. All of my routines are working. The code works, the response is empty. Customers are created. Transfers are created. Regardless, $response is always empty because $response is always a string.

This issue began on November 9th without any code changes on our end after working without issue since July, 2018.

I appreciate any assistance from other Dwolla customers who have experienced a similar issue.

Thanks,
Dominic


(Spencer Hunter) #2

Closing the loop on this thread. Thanks to @Dominic_Morrocco, we were able to identify an issue with dwolla-swagger-php and how it was parsing 201 responses from the API. A patch fix was pushed and a new version was published to packagist. To provide additional context, the API client was attempting to parse the raw HTTP Location header and was failing as a result of the raw header being lowercase location when the client expected an uppercase Location.