Problem uploading bank statement

Hi,

I am trying to upload CSV files exported from Amazon into a bank account. The same file works when I upload it manually.

I am using the code below:

$url = “https://api.freeagent.com/v2/bank_transactions/statement?bank_account=removed”;
curl_setopt($ch, CURLOPT_HTTPHEADER, array( “Content-Type: application/json”, “Authorization: Bearer $access”, “Accept: application/xml”, “User-Agent: Amazon”, ));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);

$filename = realpath(’./amazon.csv’);
$post=array(‘statement’=> ‘@’ . $filename);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$result=curl_exec ($ch);

I am receiving a “Resource not found” error.
Does anyone have any working example code they can share or point me in the direction in an error in the above?

thanks!

Doh, I figured it out - the bank account in the URL should be the URL for the account not just the account number id.