Page 1 of 1

Aimeos and REST API

Posted: 23 Aug 2015, 04:26
by vikram
I was wondering if there is some feature to manage export of basic products details to an external accounting system based on Rest-api service. I also need to update the stock value from the accounting system.

Since the stock update is one way and not a sync I was thinking of creating a csv file from the rest-api and then do a csv import into Aimeos.

Are there better ways to do these?
Any tip/suggestion :idea:

Re: Aimeos and REST API

Posted: 23 Aug 2015, 10:47
by aimeos
vikram wrote:I was wondering if there is some feature to manage export of basic products details to an external accounting system based on Rest-api service. I also need to update the stock value from the accounting system.
Do you want to export the product details or the ordered products of customers?
vikram wrote: Since the stock update is one way and not a sync I was thinking of creating a csv file from the rest-api and then do a csv import into Aimeos.
That's possible for sure but would be only a work-around. You could create a job controller that asks the REST API directly to get all stock levels and update the stock information by using the product stock manager. You can use the product CSV import job controller as reference for writing your own job controller and the stock import processor for how stock updates are done.

Have a look at the code and documentation:
- https://aimeos.org/docs/Developers/Cont ... controller
- https://github.com/aimeos/aimeos-core/t ... Import/Csv
- https://github.com/aimeos/aimeos-core/b ... efault.php

Re: Aimeos and REST API

Posted: 23 Aug 2015, 14:47
by vikram
I need to export all products and orders when they are placed. The account system would also generate pdf invoices which I would need to import back into Aimeos.

Thank you for tip related to stock update.

Re: Aimeos and REST API

Posted: 23 Aug 2015, 15:19
by aimeos
vikram wrote:I need to export all products and orders when they are placed. The account system would also generate pdf invoices which I would need to import back into Aimeos.
This is the job of the delivery service providers. You should create a new one talking to the REST API of your account system and pushing the order to that system. You can use the default delivery service provider as reference:
- https://aimeos.org/docs/Developers/Library/Service
- https://github.com/aimeos/aimeos-core/b ... efault.php

The delivery service providers are executed by one of the scheduler tasks which you have to enable and you have to configure the new service provider so it's used in the checkout process (delivery step): https://aimeos.org/docs/User_Manual/Adm ... ce_details

You can store the path to the invoice PDF as order service attribute in the database: https://aimeos.org/docs/Developers/Libr ... attributes
When you update the delivery status of the order (maybe to "in progress"), a new e-mail is sent for that status and you can add a new subpart for the "email delivery" client that attaches the PDF to the e-mail. For that part, we would love to get a pull request from you ;-)

Re: Aimeos and REST API

Posted: 23 Aug 2015, 15:52
by vikram
Thank you for all the tips. It is going to take some time for me get familiar with those since I am very new to Aimoes.

One last request :)
I need to initialize the accounting system with products from Aimoes. And every time new products is added or modified it needs to be pushed to the Accounting system.

The Accounting system is being used only for stock data management and invoice generation. I guess from here the order would be marked as shipped or complete. They may have offline payment as well.

Re: Aimeos and REST API

Posted: 23 Aug 2015, 16:13
by aimeos
vikram wrote:Thank you for all the tips. It is going to take some time for me get familiar with those since I am very new to Aimoes.
You can do almost everything with Aimeos but that freedom adds some complexity to the system. Feel free to ask everything you don't understand yet :-)
vikram wrote:I need to initialize the accounting system with products from Aimoes. And every time new products is added or modified it needs to be pushed to the Accounting system.

The Accounting system is being used only for stock data management and invoice generation. I guess from here the order would be marked as shipped or complete. They may have offline payment as well.
If your client will use the Aimeos administration interface, you can hook into the product ExtJS controller and push the changes to the account system: https://github.com/aimeos/aimeos-core/b ... efault.php
The finish() method would be the best place and I would write a decorator so you don't need to touch the existing code or subclass the existing class.