Jump to content

MashterSoporte

Members
  • Posts

    5
  • Joined

  • Last visited

MashterSoporte's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. in the previous post i am using a Chrome extension HTTP Client (Boomerang) beacause i cant use the SDK This is my PHP Code if i use the API SDK <?php require_once 'api/blesta_api.php'; $user = "isaac"; $key = "a5-----------------0f4f"; $url = "http://domain.com/api"; $api = new BlestaApi($url, $user, $key); $args = array( 'vars' => array( 'username' => 'fulanito', 'new_password' => 'Mash.123', 'confirm_password' => 'Mash.123', 'client_group_id' => 1, 'first_name' => 'Fulanito', 'last_name' => 'De tal', 'email' => 'fulanito@moesbar.com', 'state' => 'AGU', 'country' => 'MX', 'zip' => '27000', 'settings' => array( 'default_currency' => 'MXN', 'language' => 'es_es', 'tax_exempt' => true, 'send_registration_email' => false ) ) ); $response = $api->post('clients', 'create', $args); var_dump($response); The var_dump show this: object(BlestaResponse)#2 (2) { ["raw":"BlestaResponse":private]=> string(0) "" ["response_code":"BlestaResponse":private]=> int(302) }
  2. I sending to domain.com/api/clients/create.xml with method POST <?xml version="1.0" encoding="UTF-8" ?> <vars> <username>fulanito</username> <new_password>mash123</new_password> <confirm_password>mash123</confirm_password> <client_group_id>1</client_group_id> <status>active</status> <firstname>Fulanito</firstname> <last_name>De tal</last_name> <email>fulanito@email.com</email> <state>AGU</state> <country>MX</country> <zip>27000</zip> <settings> <default_currency>MXN</default_currency> <language>es_es</language> <username_type>username</username_type> <tax_id /> <tax_exempt>true</tax_exempt> <send_registration_email>false</send_registration_email> </settings> </vars> And get this response HTTP/1.1 400 "Bad Request" 1317ms Date: Thu, 07 Apr 2016 22:12:11 GMT Server: Apache/2.2.15 (CentOS) Connection: close X-Powered-By: PHP/5.3.3 Content-Length: 369 Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" ?> <clients> <message>The request cannot be fulfilled due to bad syntax.</message> <errors> <username> <empty>Por favor, introduce un nombre de usuario.</empty> </username> <new_password> <format>Por favor ingrese una contraseƱa de al menos 6 caracteres.</format> </new_password> </errors> <response /> </clients> Whats is wrong?
  3. I sending the same fields of the add clients form: _csrf_token first_name last_name company address1 address2 ... Here a screenshot: http://www.mediafire.com/view/ljxjd3o1tt9m4t4/blesta.png
  4. I downloaded the API SDK, i cant get a response, but i use a HTTP Client (Chrome Extension - Boomerang) and get a response with the clients information, i try with "http://domain.com/api/clients/add/post.json"sending the params of add client form but i get this: "{ "message": "The format requested is not supported by the server.", "response": null }"
  5. I need import from other database my customers list to clients in blesta, but i want do it from API, how can i do it? (I'm sorry, but I know a little english)
×
×
  • Create New...