I am trying to make a POST request to the GETResponse API(https://apidocs.getresponse.com/v3/case-study/adding-contacts) with thephpleague/oauth2-client and adespresso/oauth2-getresponse as a provider like so:
$data = [
'email' => $email,
'campaign' => [
'campaignId' => $campId
]
];
$request = $this->provider->getAuthenticatedRequest(
'POST',
'https://api.getresponse.com/v3/contacts',
$this->getMyAccessToken(),
$data
);
$response = $this->provider->getParsedResponse($request);
I also tried this passing in content type value of application/json in the headers all to no avail.
$data = [ 'email' => $email, 'campaign' => [ 'campaignId' => $campId ] ];
`$options['body'] = json_encode($data);
$options['headers']['Content-Type'] = 'application/json';
$options['headers']['access_token'] = $this->getMyAccessToken();
$request = $this->provider->getAuthenticatedRequest(
'POST',
'https://api.getresponse.com/v3/contacts',
$options
);
$response = $this->provider->getParsedResponse($request); `
However the getParsedResponse function in both approaches returns the following:
League \ OAuth2 \ Client \ Provider \ Exception \ IdentityProviderException (400) UnsupportedContentTypeheader.