Re: REST API

All the $ variables need to be populated and then the sql needs to be extracted.
Read the Troubleshooting page in the Wiki.

Re: REST API

Downloaded and unzipped frontaccounting-2.4-api.module.1.7 as directed to /modules/api/ directory.

Changes variables in util.php to match my current test company.

Directed browser to : https://MY_FA_URL/modules/api/category/ as suggested.

Received a blank page with no results.

In the /modules/api/error.log file the following:

PHP Parse error:  syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /MY_FA_URL/modules/api/index.php on line 2

Stuck here.  Help or suggestions appreciated.

Note: 'MY_FA_URL' replaced with actual URL to site.

Re: REST API

Can you check your PHP version.?

Is it greater than 5.3 ?

Because the index.php line no 2 is namespace use . If your PHP is lower than 5.4 it won't work with namespace.

Hope it helps you

Re: REST API

You can use my unofficial version for PHP 5.3.

Post's attachments

api24.zip 209.2 kb, 1 downloads since 2018-09-05 

You don't have the permssions to download the attachments of this post.

80 (edited by neholtz 09/05/2018 07:22:27 pm)

Re: REST API

Hosting Server php is 5.6

I also could not find anywhere within the api files where those namespaces were defined.

Re: REST API

@neholtz, try apmuthus repo files. And if you have the same issue. Just copy ten lines of index.php inside API directory

Re: REST API

@kvvaradha, I will try apmuthu's version shortly.

I was trying to see why this version was not performing under php 5.6 which is the version selected on my host.

Here is the log error.log file under /modules/api/

Quoting:

[06-Sep-2018 11:38:38] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/56/usr/lib64/php/modules/imagick.so' - /usr/php/56/usr/lib64/php/modules/imagick.so: undefined symbol: zend_new_interned_string in Unknown on line 0
[06-Sep-2018 11:38:38] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/56/usr/lib64/php/modules/pdo_mysql.so' - /usr/php/56/usr/lib64/php/modules/pdo_mysql.so: undefined symbol: mysqlnd_allocator in Unknown on line 0
[06-Sep-2018 11:38:38] PHP Warning:  PHP Startup: pdo_sqlite: Unable to initialize module
Module compiled with module API=20131226, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
[06-Sep-2018 11:38:38] PHP Warning:  PHP Startup: pdo_pgsql: Unable to initialize module
Module compiled with module API=20131226, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
[06-Sep-2018 11:38:38] PHP Warning:  PHP Startup: magickwand: Unable to initialize module
Module compiled with module API=20131226, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
in Unknown on line 0
[06-Sep-2018 11:38:38] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/56/usr/lib64/php/modules/mailparse.so' - /usr/php/56/usr/lib64/php/modules/mailparse.so: undefined symbol: zend_new_interned_string in Unknown on line 0
[06-Sep-2018 11:38:38] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/56/usr/lib64/php/modules/oauth.so' - /usr/php/56/usr/lib64/php/modules/oauth.so: undefined symbol: zend_new_interned_string in Unknown on line 0
[06-Sep-2018 11:38:38] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/56/usr/lib64/php/modules/oci8.so' - /usr/php/56/usr/lib64/php/modules/oci8.so: undefined symbol: zend_new_interned_string in Unknown on line 0
[06-Sep-2018 11:38:38] PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/php/56/usr/lib64/php/modules/uploadprogress.so' - /usr/php/56/usr/lib64/php/modules/uploadprogress.so: undefined symbol: zend_ini_string_ex in Unknown on line 0
[06-Sep-2018 11:38:38] PHP Parse error:  syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /home2/finishl4/public_html/erp/modules/api/index.php on line 2

End of Quoting.

Tech support from my Host has been unable to explain why calls to php 5.6 library modules are unable to be found.  I am awaiting an escalated callback on the ticket.

Beyond that the question is if apmuthu's version for 5.3 will run under 5.6.  I will try it and post results here.

neholtz

Re: REST API

Downloaded, unzipped and uploaded apmuthu's unofficial version for PHP 5.3 to MY_FA_URL/modules/api24/.

Edited util.php with applicable credentials for my FA installation.

Tested on same Host with the following result for https://MY_FA_URL/modules/api/category:

MY_HOST_URL.com is currently unable to handle this request.
HTTP ERROR 500

I noticed the following:

1. There is no error.log generated under /modules/api/

2. In comparing the index.php from apmuthu's version to the June 26, 2018 one, apmuthu's had:

<?php
ini_set('html_errors', false);

include_once ('config_api.php');
foreach (glob("src/*.php") as $filename)
    include $filename;

use FAAPI\Inventory;
use FAAPI\InventoryLocations;
use FAAPI\Category;
use FAAPI\TaxTypes;
use FAAPI\TaxGroups;
use FAAPI\Customers;
use FAAPI\Suppliers;
use FAAPI\BankAccounts;
use FAAPI\GLAccounts;
use FAAPI\Currencies;
use FAAPI\InventoryCosts;
use FAAPI\Sales;
use FAAPI\Dimensions;
use FAAPI\Journal;
use FAAPI\Purchases;

Where the later version only had the use FAFPI\ namespaces.  In other words without the following:

ini_set('html_errors', false);

include_once ('config_api.php');
foreach (glob("src/*.php") as $filename)
    include $filename;

So neither version will run for me. 

It is important to note that my installed version of FA 2.4.4 is running perfectly fine on the same server with php 5.6.

Not sure of a path forward at this moment.

Re: REST API

It's better to check with your hosting provider. It looks like some modules are not working inside php library. If possible upgrade your PHP version than try this.

Re: REST API

@kvvaradha,

Hosting server currently running php 5.6.   The only move beyond that available is php 7.0.31.

I am awaiting a callback from Hosting's escalated tech support as the Level 1 was unable to shed any light on the matter.

I will post their comments if/when I have their response.

Until then.....