I'm getting a surprising response from Freelancer.com when I try one of their APIs:
This was the response:
HTTP/2 400
content-type: application/json
server: nginx
cache-control: no-store, no-cache
ratelimit-limit: 400, 400;window=60, 2000;window=3600
ratelimit-remaining: 399
access-control-allow-origin: *
accept-ranges: bytes
via: 1.1 varnish, 1.1 varnish
date: Thu, 18 May 2023 16:52:22 GMT
x-served-by: cache-iad-kjyo7100055-IAD, cache-lon420095-LON
x-cache: MISS, MISS
x-cache-hits: 0, 0
vary: X-Request-Host
x-fastly-request-id: 90c65d3e-a377-4439-bc36-9dbd74a40d6b
content-length: 163
{
"status": "error",
"message": "bids_get requires id based filter",
"error_code": "ProjectExceptionCodes.DAO_EXCEPTION",
"request_id": "a138a2daaaffcc3478820649d90b69b1"
}
I was expecting a JSON response of a list of bids for the two projects.
The code I'm using to request it is as follows:
// Neither of these two requests work. Same result for both.
$url = 'https://www.freelancer.com/api/projects/0.1/bids/?'
.'projects[]=36608601&projects[]=36608595';
$url = 'https://www.freelancer.com/api/projects/0.1/bids/?'
.'projects[0]=36608601&projects[1]=36608595';
$rr = new RequestResponse($url, [], [
'freelancer-oauth-v1: ' . $token
]);
$responseBody = $rr->get();
$objects = json_decode($responseBody, true);
echo "<pre>".$rr->responseHeaders."</pre>";
echo "<pre>".json_encode($objects, JSON_PRETTY_PRINT)."</pre>";
What am I doing wrong? I've specified the IDs of two projects that I want to retrieve bids for, so I don't understand the error bids_get requires id based filter
. Thanks