Modules:IDL Load Web Services
Overview
The import process of all available entities in the Initial Data Load module can be accessed as a REST Web Service. This document explains how to use these Web Services.
Web Service access
The import processes available as web services are only the step of the process that saves the data in the Openbravo ERP database. These web services are based on the Openbravo ERP REST framework.
If you have Openbravo ERP installed in the URL http://localhost/openbravo, the Web Service for each entity can be access in the URL http://localhost/openbravo/ws/org.openbravo.idl.process/Entity_Name. Where Entity_Name is the name of the entity you want to import.
The Web Service provides two methods for authentication:
- Basic http authentication.
- User and password passed as request parameters (the parameter names are resp. l and p).
The Web Service is accessed using the HTTP method POST and the rest of HTTP methods are not available. The fields required for the XML file of the content to send to the web service are in the Entities Definition document.
Note that all Web Services process do not include neither the validation step nor the default values replacement step.
Example
To test these web services a good tool is Poster, a Firefox add-on that allows to make HTTP requests and inspect the results.
For example to import one product, first we have to write the XML file with all field values of the product we want to import.
<?xml version="1.0" encoding="UTF-8"?> <ob:Openbravo xmlns:ob="http://www.openbravo.com"> <Product> <Organization>0</Organization> <SearchKey>pfga</SearchKey> <Name>Final good A</Name> <Description>Final good A for selling</Description> <UPCEAN>3344567</UPCEAN> <ProductCategory>Final goods</ProductCategory> <UOM>Kg</UOM> <ProductType>Item</ProductType> <Production>False</Production> <BillOfMaterial>False</BillOfMaterial> <Discontinued>False</Discontinued> <CostType>Average</CostType> <AttributeSet>Lots</AttributeSet> <AttributeValue>123</AttributeValue> <Stocked>True</Stocked> <Purchase>False</Purchase> <Sale>True</Sale> <TaxCategory>IVA 16%</TaxCategory> <StandardCost></StandardCost> <PriceSales>19.90</PriceSales> <PricePurchase></PricePurchase> </Product> </ob:Openbravo>
Open the Poster dialog and fill in the required fields:
- URL of the import process to execute.
- Authentication for Openbravo ERP. User and password.
- Product entity in the content to send.
To load the product into Openbravo ERP just press the Post action and it the execution is successful, in the response you will get the product just loaded in Openbravo ERP.