Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid API request signature. Please refer to the documentation while creating subscribers in Mailwizz sdk #15

Closed
rameshwebmaster opened this issue Nov 24, 2017 · 4 comments

Comments

@rameshwebmaster
Copy link

hello ,
when i create subscription it gives me this error "Invalid API request signature. Please refer to the documentation".
i have used Mailwizz php-sdk for create lists,campaign.All are getting created successfully except only subscriber is not getting created.
I am using Lumen framework.
this is my code for creating subscription->

                     // CREATE THE ENDPOINT
			$endpoint = new \MailWizzApi_Endpoint_ListSubscribers();
			// ADD SUBSCRIBER
			$response = $endpoint->create($list_uid, array(
			    'EMAIL'    =>'[email protected]', //$data['email'], // the confirmation email will be sent!!! Use valid email address
			    'FNAME'    => 'ABC',
			    'LNAME'    => 'XYZ'//$data['name']
			));

var_dump($response);exit;

This is my construct function

public function __construct() {

	// configuration object
	$this->config = new \MailWizzApi_Config(array(
		'apiUrl'        => config('api_c.apiUrl'),
		'publicKey'     =>config('api_c.publicKey'),
		'privateKey'    => config('api_c.privateKey'),

	// components
		'components' => array(
				'cache' => array(
					'class'     => 'MailWizzApi_Cache_File',
					'filesPath' => dirname(__FILE__) . '/../../../vendor/twisted1919/mailwizz-php-sdk/MailWizzApi/Cache/data/cache', // make sure it is writable by webserver
				)
		),
	));
	// now inject the configuration and we are ready to make api calls
	\MailWizzApi_Base::setConfig($this->config);
	MailWizzApi_Autoloader::register();
}

When i dump client request ->

object(MailWizzApi_Http_Client)#2191 (11) {
["paramsGet"]=>
object(MailWizzApi_Params)#2184 (2) {
["_data":"MailWizzApi_Params":private]=>
array(0) {
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["paramsPost"]=>
object(MailWizzApi_Params)#2194 (2) {
["_data":"MailWizzApi_Params":private]=>
array(3) {
["EMAIL"]=>
string(24) "[email protected]"
["FNAME"]=>
string(6) "ABC"
["LNAME"]=>
string(5) "XYZ"
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["paramsPut"]=>
object(MailWizzApi_Params)#2196 (2) {
["_data":"MailWizzApi_Params":private]=>
array(0) {
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["paramsDelete"]=>
object(MailWizzApi_Params)#2197 (2) {
["_data":"MailWizzApi_Params":private]=>
array(0) {
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["headers"]=>
object(MailWizzApi_Params)#2198 (2) {
["_data":"MailWizzApi_Params":private]=>
array(0) {
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["url"]=>
string(69) "http://massmail.xxxxx.com/api/lists/aq39684ebr853/subscribers"
["timeout"]=>
int(30)
["signRequest"]=>
bool(true)
["getResponseHeaders"]=>
bool(false)
["enableCache"]=>
bool(false)
["method"]=>
string(4) "POST"
}

I got following response from server-

object(MailWizzApi_Http_Response)#2204 (11) {
["url"]=>
string(69) "http://massmail.xxxxx.com/api/lists/kh966r7z84cb9/subscribers"
["headers"]=>
NULL
["contentType"]=>
string(31) "application/json; charset=UTF-8"
["httpMessage"]=>
string(11) "Bad Request"
["curlCode"]=>
int(0)
["curlMessage"]=>
string(0) ""
["storeCurlInfo"]=>
bool(false)
["curlInfo"]=>
NULL
["body"]=>
object(MailWizzApi_Params)#2202 (2) {
["_data":"MailWizzApi_Params":private]=>
array(2) {
["status"]=>
string(5) "error"
["error"]=>
string(65) "Invalid API request signature. Please refer to the documentation."
}
["_readOnly":"MailWizzApi_Params":private]=>
bool(false)
}
["request"]=>
NULL
["_httpCode":"MailWizzApi_Http_Response":private]=>
int(400)
}
Please help me out .

Thanks in Advance.

@magicdude4eva
Copy link

Under API, turn off API signature:
image

@rameshwebmaster
Copy link
Author

I checked in mailmass dashboard, there is not this option. I'm calling this function from queue job handller so that time it gives issue.otherwise it's working properly.

@rameshwebmaster
Copy link
Author

is there any way to make api signature while crating subscribers?

@rameshwebmaster
Copy link
Author

resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants