Open chuntin opened 7 years ago
I have this:
$params = ['filters' => "[('country_id', '=', 69')]"]; $body = Unirest\Request\Body::Json($params); $response = Unirest\Request::get($this->url.':'.$this->port.'/api/res.country.state', $this->headers, $body);
but it, doesn't send any parameters.
the api that i try to request request me a GET method with params in a json format
works good with:
` $params = ['filters' => "[('country_id', '=', 69)]"];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => $this->port,
CURLOPT_URL => $this->url.'/api/res.country.state',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => json_encode($params),
CURLOPT_HTTPHEADER => [
'access_token: '.$this->accessToken,
'content-type: text/html'
],
]
);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);`
Hi, i need to do this;
curl -v -i -k -H "Content-Type: text/html" http://localhost:8069/api/res.partner -X GET -H "access_token: XXXXXXXXXXXXXXXXX" -d '{"filters": "[(\"name\", \"like\", \"company\"), (\"id\", \"<=\", 50)]"}'
how could i do that?
Thank you