Jump to content

Getting Private Response Code From Clients::create


gutterboy

Recommended Posts

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!?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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().

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...