Reputation: 1880
I had made a simple APP which automatically creates my upwork invoices to my Invoice ninja setup but lately, upwork side broke. I saw that there were updates and changes on it but after my research, nothing changed in my specific call. After the authorization, I am using the following call:
$finreports = new \Upwork\API\Routers\Reports\Finance\Accounts($upwork_client);
$freelancerReference = "8009XXX";
$params = array(
"tq" => "SELECT amount, notes WHERE date >= '2018-06-01' AND date <= '2018-06-30'"
);
$results = $finreports->getOwned($freelancerReference, $params);
echo "<pre>".print_r($results, true)."</pre>";
and i am receiving this:
stdClass Object
(
[version] => 0.6
[status] => error
[errors] => Array
(
[0] => stdClass Object
(
[reason] => invalid_query
[message] => Internal Server Error
)
)
The auth seems OK because I can successfully get the response from:
$auth->getUserInfo();
Upvotes: 1
Views: 245
Reputation: 1
Since mnovozhilov is the author on the Upwork API library files that I've read, it is great to have his confimation that the Accounts API has been deprecated.
Perhaps you can get the information you need through billings. Just a note that the API documentation says to use: from upwork.routers.reports import billings
But for the version I have, there is an extra finance folder, so I need to use: from upwork.routers.reports.finance import billings
I've been checking my paths by looking in File Explorer at the install folder\Lib\site-packages\upwork...., to see where the import files are located.
With your team reference you can use get_by_buyers_team(self, buyer_team_reference, params)
With your company reference you can use get_by_buyers_company(self, buyer_company_reference, params)
Upvotes: 0
Reputation: 319
it's a pity to hear that your reporting system stopped working correctly. Unfortunately, you use the API which is marked for deprecation. Inherently, the changes are being rolled out, and that seems to be the root of the issue you experience - see the proper announce.
Upvotes: 1