Jump to content

Recommended Posts

Posted
Hi,
When i  try  to create a new invoice using,
$response = $api->post("invoices", "add", $vars);
it always shows error like,


Internal error: Failed to retrieve the default valuestdClass Object ( [error] => stdClass Object ( [message] => An unexpected error occured. [response] => Internal error: Failed to retrieve the default value ) )

 

 

even if i hard code all the values same error comes

Same problem comes in  Add Acount Section also

 

Below is the var array  i used.

 

$vars = array(
        'client_id' => 1,
        'date_billed' => date('2014-08-16 11:04:03'),
        'date_due' => date('2014-08-120 11:04:03'),
        'currency' => "USDD",
        'lines' => array(
            array(
                'description' => "Line item #1",
                'amount' => "5.99"
            ),
            array(
                'description' => "Line item #2",
                'amount' => "3.75",
                'qty' => 2
            )
        ),
        'delivery' => array("email")
   
);

Posted

Usually an internal error regarding a missing default value means that a required parameter is missing, i.e. the system is not receiving a 'vars' parameter.

 

The solution would be to make sure each parameter is set:

$data = array(
    'vars' => array(
        'client_id' => 1,
        ...
    )
);

$api->post("invoices", "add", $data);
Posted

Tyson,

 

Thanks a lot for the reply. your reply helped us to fix the issue.

 

I have another issue now,

 

When i try to create a New Package Group using the code,

$data=array("vars"=>array( "company_id" => 1,"name" => $_POST['names'], "type" => $_POST['type']));
$addgroup = $api->post("package_groups", "add", $data);
it returns  below error.

stdClass Object ( [name] => stdClass Object ( [empty] => Please specify a package group name. ) )
 

Do you know why i am getting that error?

Posted

Tyson,

 

Thanks a lot for the reply. your reply helped us to fix the issue.

 

I have another issue now,

 

When i try to create a New Package Group using the code,

$data=array("vars"=>array( "company_id" => 1,"name" => $_POST['names'], "type" => $_POST['type']));
$addgroup = $api->post("package_groups", "add", $data);
it returns  below error.

stdClass Object ( [name] => stdClass Object ( [empty] => Please specify a package group name. ) )
 

Do you know why i am getting that error?

Posted

Sounds like $_POST['names'] is actually blank. What is the value?

 

I notice the key is plural, perhaps your form is using "name" rather than "names"?

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