I am trying to do a simple API post using Guzzle. The API however keeps returning the error "UnsupportedApiVersion [Message] => The requested resource with API version '1' does not support HTTP method 'GET'."
When doing a simple post through postman using Content-Type: application/json header and a simple body:
{
"Username" : "xxxxxxx",
"Password" : "xxxxxxx",
"ApplicationID" : "xxxxxxx",
"DeveloperID" : "xxxxxxx"
}
It works fine and i get a result back as expected.
However when using the following code i keep getting a method GET is not supported error.
public function connect()
{
$client = new Client([
'base_uri' => $this->url,
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'http_errors' => $this->getHttpErrors(),
]);
return $client;
}
public function login()
{
$client = $this->connect();
$res = $client->post($this->url.'auth/signin', [
'json' => [
'ApplicationID' => xxxxxx,
'DeveloperID' => xxxxxx,
'Username' => xxxxxx,
'Password' => xxxxxx
]
]);
$results = json_decode($res->getBody());
return $results;
}
Instead of using 'json' i have tried 'form_params' which gives me the same result.
I am using Guzzle 6.3.3
jsonwithquery? - dearsinaqueryunfortunately gives me the same result - Renee Thomassen