Topic: Slim REST API module for FA 2.4.x - No Composer

A fully working non-composer-ised version of the Slim2 REST Framework customised for FA 2.4.x is now available.

@joe: Attachements don't work for this version of the forum as yet.- Now done.

Re: Slim REST API module for FA 2.4.x - No Composer

The Slim2 REST API integration for FA 2.4.3 is now attached herein. This is based on Slim v2.64 with all bugfixes included.

Post's attachments

api24.zip 150 kb, 33 downloads since 2017-11-18 

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

Re: Slim REST API module for FA 2.4.x - No Composer

The output of a json_decode to array using the API24 can be obtained after setting the test credentials in util.php and browsing to:

http://www.yourdomain.comt/FA24PATH/modules/api24/sales/5/13

This should retrieve Sales Invoice (type=13) #5.

Attached is the text output.

Post's attachments

Sales_Invoice_REST.txt 1.8 kb, 39 downloads since 2017-11-18 

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

Re: Slim REST API module for FA 2.4.x - No Composer

Great work

www.boxygen.pk

Re: Slim REST API module for FA 2.4.x - No Composer

Excellent support!

Re: Slim REST API module for FA 2.4.x - No Composer

Great Work @Apmuthu.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Slim REST API module for FA 2.4.x - No Composer

Latest attached.

Post's attachments

api24.zip 195.3 kb, 13 downloads since 2017-12-19 

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

Re: Slim REST API module for FA 2.4.x - No Composer

I see this is great API, I want to start to work on Unicenta POS integration. There are many posts regarding to Unicenta but there are not fully functional one.  I just need to integration Sales/Stock deduction on Sales/Sales Return/Cash Transfer to Debitors/.

Please let me know your suggestions, may be there are already work have been done on this previously so I can continue this. Please let me know your suggestions.

Regards

Re: Slim REST API module for FA 2.4.x - No Composer

The Unicenta/OpenBravo POS is a compiled application for Windows/Linux/MacOS etc and is currently at v4.1. The database is at v3.91.3 and uses the Apache Derby DB by default. It can be configured to use MySQL database among others, but no public MySQL schema for it is commonly available. Make a set of unitary transactions in Unicenta POS and at each execution list the database changes that have occurred with respect to the actual transactions done that you want to port to FA. Then use and possibly extend the SlimREST API for FA as desired.

Re: Slim REST API module for FA 2.4.x - No Composer

Hi,

I know Unicenta/Chromis very well and the MySQL-DB is well described. I know exactly where transactions are stored and what records get changed. I might be of help there.
I have been looking for a way to connect the two for years now and am in contact with Talend, that however seems an enormous overkill.

A fairly simple POS is "OS POS" or "pos_on" which is all PHP/MySQL.

Where do I start when I want to contribute in integrating a pos-solution?

Regards,
Jan

Re: Slim REST API module for FA 2.4.x - No Composer

Start a project on GitHub and get others to fork and contribute.

Re: Slim REST API module for FA 2.4.x - No Composer

Hi,

I had a closer look and will first try the transactions module in combination with Chromispos.
This module is new to me and looks very good, thanks apmuthu!

Kind regards,
Jan

Re: Slim REST API module for FA 2.4.x - No Composer

The latest version is attached herein and complies with changes in the 2017-12-19 core commit for VARLOG_PATH and VARLIB_PATH (the latter is exclusively used herein as per relevant core inclusions).

CHANGELOG

Post's attachments

api24.zip 195.4 kb, 27 downloads since 2018-02-18 

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

Re: Slim REST API module for FA 2.4.x - No Composer

@apmuthu I tested this api.

ON https://frontaccounting.com/fawiki/index.php?n=Devel.SimpleAPIModule?action=browse

fabridge.php shall have following commit

$headers[] = "X_company: "  . COMPANY_NO;
$headers[] = "X_user: "     . REST_USER;
$headers[] = "X_password: " . REST_PWD;

shall be changed to

$headers[] = "X-COMPANY: "  . COMPANY_NO;
$headers[] = "X-USER: "     . REST_USER;
$headers[] = "X-PASSWORD: " . REST_PWD;

to comply it with util.php

www.boxygen.pk

Re: Slim REST API module for FA 2.4.x - No Composer

@boxygen: Thanks.
Done and updated the zips as well.

This change occurred when it was ported to FA 2.4 when all capitals and hyphen came into effect. In FA 2.3 it the way it was with lower and upper case and underscore as well.

For those using FA 2.3, make sure it is the way it was earlier.

Re: Slim REST API module for FA 2.4.x - No Composer

I want to modify this api module to execute Recurring Invoices automatically through a cron call. Is it workable idea? If yes then can you guide me over this?

www.boxygen.pk

Re: Slim REST API module for FA 2.4.x - No Composer

1. create a script to use the API as in the wiki.
2. Add in code to specify the shebang line at the top for CLI execution and set the php.ini settings for FA in it.
3. now execute it manually to see if the recurring invoices script works.

Otherwise, just take a backup of the FA SQL and execute a manual recurring invoice and compare with the later backup of FA sql and see what changed and write a simple bash / php script to get it done and put it into the crontab of any linux server or on windows use VisualCRON or Task Scheduler.

Re: Slim REST API module for FA 2.4.x - No Composer

Or you could just use the shell script approach to running any web page, i.e.:

#!/bin/bash

wget -q --save-cookies /tmp/cookies$$.txt \
     --keep-session-cookies \
     --post-data 'user_name_entry_field=xxx&password=yyy&company_login_name=1' \
     --delete-after \
     https://myfawebsite/index.php

# customer detail list
wget -q --load-cookies /tmp/cookies$$.txt \
    -O - https://myfawebsite/reporting/rep103.php \
    --post-data "PARAM_0=09/13/2019&PARAM_1=&PARAM_2=&PARAM_3=&PARAM_4=&PARAM_5=&PARAM_6=&PARAM_7=0&REP_ID=103" > /tmp/foo.pdf

where post-data are the $_POST fields sent by the FA web page.

Re: Slim REST API module for FA 2.4.x - No Composer

@braathwaate: Good one indeed.

Make sure the /tmp folder exists and is writeable.

The $$ is the PID (Process ID) of the shell which is expected to be random for that session.

Wiki-ed it.

Bash Scripting Cheatsheet

Post's attachments

BashCheatSheet.png 428.6 kb, file has never been downloaded. 

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