Jump to content

Decrypt Blesta Custom Client Field


serge

Recommended Posts

documentation give this php code example:

<?php
require_once "blesta_api.php";
 
$user = "username";
$key = "key";
$url = "https://yourdomain.com/installpath/api/";
 
$api = new BlestaApi($url, $user, $key);
 
$response = $api->get("users", "get", array('user_id' => 1));
 
print_r($response->response());
print_r($response->errors());
?>

but I do not understand where is this file:

 

blesta_api.php

Link to comment
Share on other sites

documentation give this php code example:

<?php
require_once "blesta_api.php";
 
$user = "username";
$key = "key";
$url = "https://yourdomain.com/installpath/api/";
 
$api = new BlestaApi($url, $user, $key);
 
$response = $api->get("users", "get", array('user_id' => 1));
 
print_r($response->response());
print_r($response->errors());
?>

but I do not understand where is this file:

 

blesta_api.php

It will be there after you download SDK API and put it in install dir  ,https://github.com/phillipsdata/blesta_sdk

Link to comment
Share on other sites

yes, I just figured

 

 

I suppose now it's connecting with API, I I do have this error in my webserver log:

[Sun Jun 14 18:31:41 2015] [error] [client 108.161.128.170] user apitest not found: /index.php/api/encryption/systemDecrypt.json

and here is my code to connect with API

<?php


require_once "blesta_api.php";

require_once "blesta_response.php";


$user = "apitest";

$key = "xxxxxxxxxxxxxxxxxx";

$url = "http://dev-bill.netpublica.com/index.php/api/";

  
$api = new BlestaApi($url, $user, $key);
  
$response = $api->post("encryption", "systemDecrypt", array('value' => "GzJ9GD+TuG21ChSb4Dl0WzLpW+h8SiYcexW17UiwMJ8="));
  
print_r($response->response());
print_r($response->errors());


?>

But in blesta the API user exist with it's api key, so, I do not understand

Link to comment
Share on other sites

ok my dev server has no SSL cerrtificate, so the error I had:

 

"The API user or key appears to be invalid." was just the generic error,

 

But when trying on my live server that do have SSL certificate at blesta, the API request given fine the decrypted string

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