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!?
velaware Posted May 18, 2014 Report Posted May 18, 2014 On 5/18/2014 at 9:28 AM, gutterboy said: 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.
gutterboy Posted May 18, 2014 Author Report Posted May 18, 2014 On 5/18/2014 at 12:17 PM, secforus_ehansen said: 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.
velaware Posted May 18, 2014 Report Posted May 18, 2014 On 5/18/2014 at 2:08 PM, gutterboy said: 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().
gutterboy Posted May 18, 2014 Author Report Posted May 18, 2014 On 5/18/2014 at 2:14 PM, secforus_ehansen said: 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.
velaware Posted May 18, 2014 Report Posted May 18, 2014 On 5/18/2014 at 2:22 PM, gutterboy said: 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.
gutterboy Posted May 18, 2014 Author Report Posted May 18, 2014 Ok thanks. Would be better if it returned more helpful error messages tbh.
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.
Blesta Addons Posted May 19, 2014 Report Posted May 19, 2014 On 5/18/2014 at 9:13 PM, Tyson said: What are the error messages, if any? in the first post BlestaResponse Object ( [raw:BlestaResponse:private] => [response_code:BlestaResponse:private] => 0 )
gutterboy Posted May 19, 2014 Author Report Posted May 19, 2014 On 5/18/2014 at 9:13 PM, Tyson said: 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 )
Tyson Posted May 19, 2014 Report Posted May 19, 2014 Double check your API credentials. Sounds like they may be incorrect.
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.
gutterboy Posted May 21, 2014 Author Report Posted May 21, 2014 On 5/19/2014 at 4:32 PM, Tyson said: 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.
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?
Cody Posted May 21, 2014 Report Posted May 21, 2014 On 5/21/2014 at 2:01 PM, gutterboy said: 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.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now