gutterboy Posted May 18, 2014 Report Posted May 18, 2014 I'm calling the clients::create() method as so.. $response = $this->api->post("clients", "create", $data); But this is what I'm getting back as the response: BlestaResponse Object ( [raw:BlestaResponse:private] => [response_code:BlestaResponse:private] => 0 ) Why is this!? Quote
velaware Posted May 18, 2014 Report Posted May 18, 2014 I'm calling the clients::create() method as so.. $response = $this->api->post("clients", "create", $data); But this is what I'm getting back as the response: BlestaResponse Object ( [raw:BlestaResponse:private] => [response_code:BlestaResponse:private] => 0 ) Why is this!? It means you're not creating the client (call fails), since Client::create() == 0/null when it fails. Look at the $data and make sure its filled with stuff that is required (name, email, username, etc...) and that the client doesn't already exist. Quote
gutterboy Posted May 18, 2014 Author Report Posted May 18, 2014 It means you're not creating the client (call fails), since Client::create() == 0/null when it fails. Look at the $data and make sure its filled with stuff that is required (name, email, username, etc...) and that the client doesn't already exist. Here is a sample of one that failed.. Array ( [vars] => Array ( [username] => bob88 [new_password] => #x@vJxn1EO [confirm_password] => #x@vJxn1EO [client_group_id] => 1 [first_name] => terry [last_name] => Moldo [company] => weee 2 [email] => xxxxxxx3@internode.on.net [address1] => 128 Moo St [numbers] => Array ( [number] => 555555555 ) [settings] => Array ( [send_registration_email] => ) ) ) send_registration_email is equal to bool false. Quote
velaware Posted May 18, 2014 Report Posted May 18, 2014 Here is a sample of one that failed.. Array ( [vars] => Array ( [username] => bob88 [new_password] => #x@vJxn1EO [confirm_password] => #x@vJxn1EO [client_group_id] => 1 [first_name] => terry [last_name] => Moldo [company] => weee 2 [email] => xxxxxxx3@internode.on.net [address1] => 128 Moo St [numbers] => Array ( [number] => 555555555 ) [settings] => Array ( [send_registration_email] => ) ) ) send_registration_email is equal to bool false. Look at app/models/clients.php. I see a few issues such as the # not in E.164 format, among others. Look at the create() method's comments above, it has all the variables to pass to Clients::create(). Quote
gutterboy Posted May 18, 2014 Author Report Posted May 18, 2014 Look at app/models/clients.php. I see a few issues such as the # not in E.164 format, among others. Look at the create() method's comments above, it has all the variables to pass to Clients::create(). If you're talking about looking at that info in the source docs, then that's where I did look to find out what info to pass. Quote
velaware Posted May 18, 2014 Report Posted May 18, 2014 If you're talking about looking at that info in the source docs, then that's where I did look to find out what info to pass. Only thing I can suggest if nothing shows in the logs is to make sure the number is formatted properly +1.<area code><rest of number> i.e.: +1.5553332211 I believe is the E.164 spec. Quote
gutterboy Posted May 18, 2014 Author Report Posted May 18, 2014 Ok thanks. Would be better if it returned more helpful error messages tbh. Quote
gutterboy Posted May 18, 2014 Author Report Posted May 18, 2014 Took the phone out, also took the address out and still get the same error. Quote
Blesta Addons Posted May 19, 2014 Report Posted May 19, 2014 What are the error messages, if any? in the first post BlestaResponse Object ( [raw:BlestaResponse:private] => [response_code:BlestaResponse:private] => 0 ) Quote
gutterboy Posted May 19, 2014 Author Report Posted May 19, 2014 What are the error messages, if any? There are none. The below is the result of a print_r of $response. BlestaResponse Object ( [raw:BlestaResponse:private] => [response_code:BlestaResponse:private] => 0 ) Quote
Tyson Posted May 19, 2014 Report Posted May 19, 2014 Double check your API credentials. Sounds like they may be incorrect. Quote
Cody Posted May 19, 2014 Report Posted May 19, 2014 I would also suggest enabling error reporting. There's likely an "invalid index" or similar error occurring and Blesta can't pass that along through the API because error reporting (looks like) is disabled. Quote
gutterboy Posted May 21, 2014 Author Report Posted May 21, 2014 Double check your API credentials. Sounds like they may be incorrect. Thanks. Seemed I was passing in a blank url after changing the name of the member variable. Quote
gutterboy Posted May 21, 2014 Author Report Posted May 21, 2014 Ok.... now I was able to add a client successfully; but now I wanted to test out errors... I get this back: BlestaResponse Object ( [raw:BlestaResponse:private] => {"message":"The request cannot be fulfilled due to bad syntax.","errors":{"username":{"unique":"That username has already been taken."}},"response":null} [response_code:BlestaResponse:private] => 400 ) How can I test/check these parameters if they are private? Quote
Cody Posted May 21, 2014 Report Posted May 21, 2014 Ok.... now I was able to add a client successfully; but now I wanted to test out errors... I get this back: BlestaResponse Object ( [raw:BlestaResponse:private] => {"message":"The request cannot be fulfilled due to bad syntax.","errors":{"username":{"unique":"That username has already been taken."}},"response":null} [response_code:BlestaResponse:private] => 400 ) How can I test/check these parameters if they are private? See the docs on using the API SDK. $response = $api->post("support_manager.support_manager_tickets", "close", array('ticket_id' => 1)); print_r($response->response()); print_r($response->errors()); You get the response from the response() method. Errors from the errors() method. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.