Jump to content

gutterboy

Members
  • Posts

    284
  • Joined

  • Last visited

Everything posted by gutterboy

  1. 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?
  2. Thanks. Seemed I was passing in a blank url after changing the name of the member variable.
  3. There are none. The below is the result of a print_r of $response. BlestaResponse Object ( [raw:BlestaResponse:private] => [response_code:BlestaResponse:private] => 0 )
  4. Took the phone out, also took the address out and still get the same error.
  5. Ok thanks. Would be better if it returned more helpful error messages tbh.
  6. 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.
  7. 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.
  8. 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!?
  9. Great - thanks! Yeah, that was the route I was probably going to go with if they couldn't have the same id. Is the id of the user contained within the returned object you get from Clients::create() ?
  10. Well not sure how else you can keep track of what invoices belong to which user on our main system unless they are mapped via their main site id somehow. Looking at the Client::add() method can't you need to pass in a user_id within the data array - why can't you pass in the user id of the user there? Though still not sure how Client::create() and Client::add() differ; from what I can tell from the system, users can be anybody (clients or staff) and then extra info is stored either in the clients table or the staff table depending on their role within the system; so trying to understand in which case you would use Client::create() and which you would use Client::add() ?
  11. Just wondering what happens if you try to add an invoice for a non-existant client via Invoice:add(). Does it automatically create a client account for them or should I always check if the user exists first and then if not create an account for them via Client::create() ? ...or should I use Client::add() or User:add() - what is the difference, do you need to call both? Ideally I would like them to use a client or user id that matches their user id in our main system.
  12. Awesome - thanks. How would I go about passing in multiple parameters, such as if I wanted to make a call to Invoices::edit() ?
  13. I have been looking over the API docs and found an example such as: $api = new BlestaApi($url, $user, $key); $data = array( 'vars' => array( 'client_id' => 1, 'date_billed' => date("c"), 'date_due' => date("c"), 'currency' => "USD", 'lines' => array( array( 'description' => "Line item #1", 'amount' => "5.99" ), array( 'description' => "Line item #2", 'amount' => "3.75", 'qty' => 2 ) ), 'delivery' => array("email") ) ); $response = $api->post("invoices", "add", $data); From what I can tell the "add" parameter we are passing in is the method we want to run from the invoices class and the $data is obviously the parameters we want to pass in the call to 'add()', but what is the first parameter? The class name I assume?
  14. Thanks for the response, but I'm still unsure what you're talking about. Just not sure how this refers to using the API? http://docs.blesta.com/display/dev/API
  15. I didn't say I was unable, I said we don't have a SSL cert.
  16. Hello, Just noticed this note in the docs: "Because each request contains your API key, and may contain additional sensitive information, you should only process requests remotely over a secure connection (i.e. only use HTTPS)" So what is the best method to make use of the API in your scripts if you don't have a SSL cert?
  17. Ok, well what is the company thing actually for anyway? Was going to setup API access and I had to setup an account for API access and it wanted a company set for it, so that's when I went to edit the company. Guess it doesn't really matter on local? The API access it just for our own site to interface with Blesta, no-one else.
  18. How can this be done? I tried to edit the default company but it won't let me progress as I'm not putting in a valid hostname when I enter "localhost". If I leave it blank I get the same error. TBH I'm not 100% sure what the company thing is all about anyway, why would I need two?
×
×
  • Create New...