Jump to content

Recommended Posts

Posted

I am using the API and I have successfully connected and used it to do other tasks like creating a user.  I am trying to add a service for a user and I am running up against an error:

I am executing the following code:

 $BlestaCreateData    = array(
                                    'vars' => array(
                                                    'client_id '        => 1512,
                                                    'use_module '       => false,
                                                    'pricing_id'        => 19,
                                                    'packages'          => array(15)
                                                )
                                    );
       
      
                                    $response =  $this->blestaapi->post('services', 'add', $BlestaCreateData);
                                    echo '<pre>';
                                    $RetVal = $response;
                                    
                                   echo var_dump($RetVal);

When I execute the code I am getting the following error:

 

object(BlestaResponse)#34 (2) {
  ["raw":"BlestaResponse":private]=>
  string(143) "{"message":"The request cannot be fulfilled due to bad syntax.","errors":{"client_id":{"exists":"The client does not exist."}},"response":null}"
  ["response_code":"BlestaResponse":private]=>
  int(400)
}

 

I am not sure if I should pass the database id value from the clients table or the id_value.  I've tried both and I keep getting the same error. Is there something I am missing?

 

 

Posted
19 hours ago, Jake said:

Now I feel really stupid.  I had spaces in the array keys.  This is fixed. Sorry to waste everyone's time

Looks like you figured it out before anyone had a chance to look into it. :blesta: 

Glad to hear it's working now!

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...