activecampaign icon indicating copy to clipboard operation
activecampaign copied to clipboard

Making a custom request?

Open MCKLtech opened this issue 3 years ago • 1 comments

I hoping to use this library as a jump-off point, but I need to make some requests that it doesn't support. For example, connections:

https://developers.activecampaign.com/reference/create-connection

I tried to make a request, but ActiveCampaign is responding that required parameters, such as name, are not being passed, even though they are in the payload:

$payload = [
		'service' => 'My Great Connector'
		'externalid' => 'amneCorp,
		'name' => 'My Great Connector',
		'linkUrl' => 'https://www.example.com,
		'logoUrl' => 'https://via.placeholder.com/150'
	];

$connection = $activeCampaign->guzzle->request('POST', 'connections', ['connection' => $payload]);

Any ideas why this would not be working? GET requests work perfectly, it seems to be the POST requests that fail, almost as if the body is never sent.

MCKLtech avatar Aug 15 '22 20:08 MCKLtech

My bad, took a second look and you need to pass the JSON parameter to Guzzle. This works:

$connection = $activeCampaign->guzzle->request( 'POST', 'connections', [ 'json' => [ 'connection' => $payload ] ] );

Might be worth adding this to the ReadME? Would be helpful for missing end points.

MCKLtech avatar Aug 15 '22 20:08 MCKLtech

Alternately, could we have the methods of MakesHttpRequests in src/MakesHttpRequests.php be public?

rharish101 avatar Jun 13 '24 13:06 rharish101

Hi @MCKLtech @rharish101,

Unfortunately, we are no longer maintaining this package, and we have decided to abandon it. As a result, we will not be addressing any further issues or pull requests. I will therefore close this issue.

We encourage the community to fork the repository if you'd like to continue development or take the project in a new direction. Thank you for your understanding.

Frankisgek avatar Aug 21 '24 07:08 Frankisgek