Table of Contents
- REST API
- API
- Scope of functions
- Directory of abbreviations
- Access
- Status codes
- API hash for authentication
- Send standard request to xentral
- Accept event handler call
- List of standard requests
- List with event handlers
- Description of API functions
- Manage orders: AuftragCreate, AuftragEdit, AuftragGet
- Manage articles: ArtikelCreate, ArtikelEdit, ArtikelGet
- Manage users: BenutzerCreate, BenutzerEdit, BenutzerGet
- Manage groups: GruppeCreate, GruppeEdit, GruppeGet
- Create and edit prices of an item: PreiseEdit
- Manage additional contact information of an address: AddresseKontaktCreate, AddresseKontaktEdit, AddresseKontaktGet
- Requests of receipts (offer to delivery note: BelegeList)
- Requests for sales: AddresseListeGet
- Manage Files: DateiList, DateiHeader, DateiDownload
- Manage files: BelegPDFHeader, BelegPDF
- Special functions of special modules
- Request data from reports: BerichteGet
- Request data from products using filters: ArtikelList
- Manage accounts: AccountCreate (from version 18.3), AccountEdit (from version 18.3), AddresseAccountsGet
- More ways to use the API
- Updated note: New API accounts as of version 20.3
REST API
Important: We no longer recommend using hash authentication to connect to the standard API. Instead, our recommendation is the REST API, which can also be used to make the function calls to the standard API (this API).
Starting with version 18.3, there is an additional REST API in the xentral ERP software, which will be further expanded in the future and will later replace the old API calls. Specific info on the xentral API can be found here.
The documentation for the REST API are in the installation at www/api/docs.html. There it explains how to create an API account, how requests to API resources need to look, what API endpoints exist, etc.
The API documentation is shipped with xentral and can be found in every xentral instance under instancename/www/api/docs.html in the browser. Often the /www/ is not needed, however.
Alternatively, the API documentation, organized by version, is also available online at: https://update.xentral.biz/apidoc/docs203.html
In principle, the version can be specified in the pathname, Version 20.1 and can be found for example in the path docs201.html.
More information about the REST API can also be found on the page xentral API.
Additional information regarding Rest-APIs
When providing tracking numbers via API no further transfer is included to get this information to shops.
This job can be done by the cronjob (shop_rueckmeldung). However, this is only working for the following logistic modes:
API
The following API documentation does NOT refer to the REST API (see above). For connecting external systems, xentral provides an API which is described below.
Scope of functions
Features of the API:
- Creating and editing addresses
- Creating and editing orders
- Creating and editing users
- Single Sign On/external start and end of session from a central Login
- Feedback on changes in xentral into the external system (event handler)
Directory of abbreviations
- Third-party system (e.g., your own web backend from your own portal)
- Xentral (Central installation of xentral)
- Hash (authentication token for API)
- Method (Call the method/Is in URL the parameter action='Name of the method. or request')
Access
In order to communicate with the API, a hash is required. To create a hash it is necessary to go to Administration → Settings → Basic Settings → API's. The hook "API activated" must be set. Under "Initkey" must be a string of any length and composed of any letters and numbers, that do not contain punctuation, special characters or umlauts. Under "Remote Domain" also an arbitrary identifier e.g.: the domain from which the the API is used (www.meinedomain.de). It is important that this is also on the other side in the client source code. There must be no / at the end. In addition, the "UTF8 Clean" check mark must remain set. Finally you have to click on the "Save" button.
After saving, the hash is created at "Current Key".
In principle there are two possibilities for the communication
- Standard request (standard POST request from the third-party system) to e.g. call a method to create a new order, address or user via the API or to edit
- Event Handler (Standard POST Request from xentral): xentral calls a stored URL when an order, address, user or similar is created or changed
The POST request is sent to the URL
index.php?module=api&action='Request'&hash=XXXXXXXXXXXX.
As POST variables must always be there:
- XML (optional if data structures are necessary)
In the variable XML, the format must be as follows:
<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>ArtikelCreate</function>
</status>
<xml>
<name_de>Saft Bene</name_de>
<nummer>1616161</nummer>
<einkaufspreise>
<staffelpreis>
<ab_menge>1</ab_menge>
<preis>728.22</preis>
<lieferantennummer>70000</lieferantennummer>
</staffelpreis>
</einkaufspreise>
<verkaufspreise>
<staffelpreis>
<ab_menge>1</ab_menge>
<preis>718,22</preis>
</staffelpreis>
<staffelpreis>
<ab_menge>1</ab_menge>
<preis>618,22</preis>
<kundennummer>10006</kundennummer>
<projekt>VM001</projekt>
</staffelpreis>
</verkaufspreise>
</xml>
</request>
</nowiki>
If the Request method sends a response, it is done as an XML structure:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>Aufgerufene Methode</action>
<message>Statusnachricht</message>
<messageCode>Statuscode (Bei Erfolg: 1, siehe unten)</messageCode>
</status>
<md5sum></md5sum>
<xml></xml>
</response>
Status codes
The following status codes are possible:
- 1: Success, everything OK (OK)
- 2: Hash wrong (Wrong Hash)
- 3: Too few GET parameters (Wrong number of GET parameters)
- 4: Wrong XML data (Wrong XML data structure for method)
- 5: Wrong key (id) (Invalid key (id))
- 6: Wrong MD5 sum (Wrong md5sum)
- 7: Username already exists (Username exists already)
- 8: Daten nicht gefunden (Data not found)
- Other: (Unknown message code)
API hash for authentication
A token is required to access the API. It is recommended to access via https to access the API.
function generateHash()
{
$initKey = 'EXsl4ywgDR5mR3sTGwws9Ikl2ocSKZlvhxoFTv8Au3MaV5UqrEIJORVF5PmFNy';
$appName = 'NameDerApp';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $appName . $date);
return $hash;
}
Send standard request to xentral
If the API module is present, it can be accessed as follows:
index.php?module=api&action='Request'&hash='Hash'
Per URL, the method or request is defined. Optional data is transferred as POST to the API.
For simple communication these functions can be used:
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://server.com/index.php?module=api&action='.$methodname.'&hash='.$hash;
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
In response to the request, an XML message follows:
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>Aufgerufene Methode</action>
<message>Statusnachricht</message>
<messageCode>Statuscode</messageCode>
</status>
<md5sum></md5sum>
<xml></xml>
</response>
Accept event handler call
To receive and evaluate events from xentral to the third-party system, the following variables are transferred via POST.
per URL: ?action=YYYY&hash=XXXXXXX
<?php
$action = $_GET['action'];
$hash = $_GET['hash'];
$xml = $_POST['xml'];
$md5sum = $_POST['md5sum'];
?>
List of standard requests
The following is a tabular listing of the standard requests:
Request (parameter action) | Description | GET parameter | XML data | XML return in success. | Description return in success. |
AdresseCreate | Create a new address | - |
XML address via POST into field xml (kundennummer= |
<id>34</id><kundennummer></kundennummer> | New ID of the address or customer number |
AdresseEdit | Change an existing address | id or kundennummer and optionally. projekt |
XML address via POST to xml field | - | - |
AdresseGet | Query an existing address |
|
- | XML address | Data structure of the requested address |
AuftragCreate | Create a new order | - | XML order via POST into field xml (belegnr=new if an should be assigned) (Note: field kundennummer is a mandatory field or can be used with the value new to create a new data record) Data such as payment methods, shipping methods etc. will be taken from the additional data of the customer master, unless they are are not explicitly transferred |
<id>34</id><belegnr></belegnr> | New ID of the order or document number |
AuftragEdit | Modify an existing order | id or belegnr and optionally projekt . |
- | - | - |
AuftragGet | Query an existing order | id or belegnr and optionally projekt . |
- | XML order | Data set of the order |
AuftragAbschliessen | Complete an order | - | XML by POST, contains ID of order | XML response code | 1-OK, 5-wrong ID or order already completed |
WeiterfuehrenAuftragZuRechnung | Continue order to invoice | - | XML via POST, contains ID of order | XML ID | Returns the ID of the generated invoice |
WeiterfuehrenRechnungZuGutschrift | ContinueInvoice to Credit Note | - | XML via POST, contains ID of invoice | XML ID | Returns the ID of the generated credit note |
ArtikelCreate | Create a new article | - | XML article | - | New item ID or item number |
ArtikelEdit | Modify an existing article | id or nummer and optionally projekt . |
XML article | - | - |
ArtikelGet | Query an existing article | id or kundennummer and optionally projekt |
- | XML article | Article data structure |
BenutzerCreate | Create a new user | - | - | - | New user ID |
BenutzerEdit | Modify an existing user | id of the user. |
- | - | - |
BenutzerList | Queries the list of users | - | - | XML user list | Simplified list of users |
BenutzerGet | Query an existing user | id of the user. |
- | - | User data structure |
BenutzerGetRFID | Query an existing user based on the RFID | - | XML rfid of the user. |
XML user | Data structure of the user |
AdresseKontaktCreate | Create another contact option | - | XML address contact | - | New ID of contact information |
AdresseKontaktEdit | Change a contact option | id or kundennummer and optionally projekt |
XML address contact | - | - |
AdresseKontaktGet | Request a contact option | id |
- | XML address contact | - |
GruppeCreate | Create another group | - | - | - | New group ID |
GruppeEdit | Modify an existing group | id of the group. |
- | - | - |
GruppeGet | Query an existing group | id of the group. |
- | - | Group data structure |
BelegeList | Queries existing receipts | - | - | XML documents | Data structure of receipts |
PreiseEdit | Change many prices | - | - | XML Prices | - |
DateiList | Queries existing files | - | - | - | Data structure of files |
ExportVorlageGet | Queries various data | id and optionally von , bis , projekt . |
- | XML data | Data structure of the selected export template |
BerichteGet | Report data queries | id |
- | XML report | Data structure of reports |
ArtikelList | Queries article data | - | XML data to be filtered with | XML articles | Article data structure |
AccountCreate | Create an account within an address | - | XML data via POST to be used for the account. | Account ID | Returns the ID of the account inside the address on success. |
AccountEdit | Edit an account within an address | id of the account. |
XML data via POST to be used for the account. | - | - |
RechnungAlsBezahltMarkieren | Mark an invoice as paid | id of the invoice. |
(Optional) XML/JSON data containing the ID of the invoice. | Invoice ID | Returns the ID of the invoice that was changed |
AngebotFreigabe | Release a quote | - | XML data containing the ID of the draft bid | XML id and belegnr | Returns the id and the generated document number |
AuftragFreigabe | Release an order | - | XML data containing the ID of the order design | XML id and belegnr | Returns the id and the generated document number |
RechnungFreigabe | Invoice approval | - | XML data containing the ID of the draft invoice | XML id and belegnr | Returns the id and the generated document number |
LieferscheinFreigabe | Delivery bill release | - | XML data containing the ID of the draft delivery note | XML id and belegnr | Returns the id and the generated document number |
BestellungFreigabe | Release an order | - | XML data containing the ID of the draft purchase order | XML id and belegnr | Returns the id and the generated document number |
GutschriftFreigabe | Credit memo release | - | XML data containing the ID of the credit note | XML id and belegnr | Returns the id and the generated document number |
AngebotVersenden | Send a quote | - | XML data: ID = id of the offer, shipping method = 'email' or 'letter', optional: printer = id of the printer to be used. | XML id | Returns the ID of the sent quote |
AuftragVersenden | Sends order confirmation | - | XML data: ID = id of the order, shipping method = 'email' or 'letter', optional: printer = id of the printer to be used. | XML id | Returns the ID of the job that was sent |
RechnungVersenden | Send an invoice | - | XML data: ID = id of invoice, shipping method = 'email' or 'letter', optional: printer = id of the printer to be used. | XML id | Returns the ID of the sent invoice |
LieferscheinVersenden | Sends a delivery note | - | XML data: ID = id of delivery bill, shipping method = 'email' or 'letter', optional: printer = id of the printer to be used. | XML id | Returns the ID of the dispatched delivery note |
GutschriftVersenden | Sends a credit note | - | XML data: ID = id of credit note, shipping method = 'email' or 'letter', optional: printer = id of the printer to be used. | XML id | Returns the ID of the sent credit note |
AngebotArchivieren | Archives an offer | - | XML data: ID = id of the quote | XML id | Returns the ID of the archived offer |
AuftragArchivieren | Archives an order | - | XML data: ID = id of the order | XML id | Returns the ID of the archived job |
RechnungArchivieren | Archive an invoice | - | XML data: ID = id of the invoice | XML id | Returns the ID of the archived invoice |
LieferscheinArchivieren | Archives a delivery note | - | XML data: ID = id of the delivery note | XML id | Returns the ID of the archived delivery note |
GutschriftArchivieren | Archives a credit note | - | XML data: ID = id of the credit | XML id | Returns the ID of the archived credit memo |
ServerTimeGet | Get the current server time | - | - | - | server time as timestamp |
StechuhrStatusGet | Query time clock status of an employee | - | id ID of the time clock, addresse ID of the employee |
XML time clock status | Current status and duration |
StechuhrStatusSet | Changes an employee's time clock status | - | cmd new status (possible values: 'come', 'go', 'pausestart', 'pausestop'), addresse ID of the Employee or user ID of the user. |
- | - |
StechuhrSummary | Query a summary of an employee's time tracking. | - | addresse ID of the employee or user ID of the user |
XML punch times | Summary of the employee's punch times |
List with event handler
When changes are made in xentral, an event (call to a configurable URL) is create The event directly receives the information for the changes. E.g. the data of an order, an address or a user.
Request (parameter action) | Description | GET parameter | XML data |
EventAdresseCreate | A new address was created | - | - |
EventAdresseEdit | There was a change to an existing address | - | - |
EventAuftragCreate | A new order was created | - | - |
EventAuftragEdit | There was a change to an existing order | - | - |
EventArtikelCreate | A new article was created | - | - |
EventArtikelEdit | There was a change to an existing article | - | - |
EventBenutzerCreate | A new user was created | - | - |
EventBenutzerEdit | There was a change to an existing user | - | - |
EventSessionClose | When user has clicked logout (see Session Management). | - | - |
Request (Parameter Action) |
Description | GET parameter | XML data |
SessionStart | Start a user's session | - | - |
SessionClose | End a user's session | - | - |
Request (Parameter Action) | Description | GET parameter | XML data |
EventSessionClose | When user clicked logout | - | - |
Description of API functions
Managing addresses: AddresseCreate, AddresseEdit, AddresseGet
In principle, any column in the database from the "addresse" table can be edited or queried. For this purpose, the column name of the table must be specified, such as <zahlungszieltage>. The same applies when creating an address.
To create a new address, the AddresseCreate function can be used. Basic parameters that should not be missing when creating an address, in order to get a meaningful address, are:
- <name> Name of the address (If address is a company, enter the name of the contact person here)
- <strasse> The street can also be used in combination with the house number in the Tag <street_house number> be used
- <hausnummer> The house number can also be used in combination with the street be used in the tag <strasse_hausnummer>
- <plz> Postal code of the address
- <ort> City of the address
- <email> Email address of the address
- <anrede> Salutation, for a company the salutation is "firma"
- <firma> company name. If filled is automatically set to "firma" set
- <vorname> If <firma>, <vorname> and <name> and are filled, the contact person is composed of <vorname> and <name>. If <vorname> is empty, only <name> is used as contact person. If <firma> is not filled, <name> is composed from <vorname> and <name>
- <projekt> Abbreviation of the project. If <projekt> is empty, the default project is selected
- <kundennummer> Customer number of the address. If a new customer number is to be assigned, NEW must be entered
- <lieferantennummer> Supplier number of the address. If a new Supplier number should be assigned, NEW must be entered
If the delivery address is different, the following parameters can be specified:
- <liefername> Name of the address to which delivery will be made. If it is is a company, here the name of the company
- <liefervorname> First name of the address to which will be delivered
- <lieferstrasse> Street to which is delivered
- <lieferhausnummer> House number to which will be delivered
- <lieferplz> Postal code of the address to which will be delivered
- <lieferort> Place of the address to which is delivered
- <lieferfirma> Company name of the address to be delivered to. If this field is filled, the address suffix is composed of <liefervorname> and <liefername>
- <lieferabteilung> Department of the address to which delivery is made
- <lieferland> country of the address to which will be delivered
Furthermore, when creating and editing an address, you can assign it a Group assign. For this, the tag <verband> can be used with the id of the group (eg <verband>34</verband>).
If an address is to be edited (AdresseEdit) or only data of the address is to be queried be retrieved (AdresseGet), the ID or the customer number must be specified. Optionally the project can be passed via the URL.
Example request AddresseCreate with functions
<?php
$hash = generateHash();
$xml = "<name>Emilia Gruber</name>
<strasse>Musterstrasse</strasse>
<hausnummer>21</hausnummer>
<plz>11111</plz>
<ort>Musterort</ort>
<email>emiliagruber@musterort.de</email>
<kundennummer>NEW</kundennummer>";
$output_xml = SendRequest("AdresseCreate",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response AddresseCreate
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>AdresseCreate</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>13</id>
<kundennummer>23243</kundennummer>
</xml>
</response>
Example request AdresseEdit with functions
<?php
$hash = generateHash();
$xml = "<name>Emilia Gruber</name>
<strasse>Musterweg</strasse>
<hausnummer>67</hausnummer>
<plz>22222</plz>
<ort>Musterhausen</ort>
<email>emiliagruber@musterhausen.de</email>";
$id = "13";
$output_xml = SendRequest("AdresseEdit",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response AddresseEdit
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>AdresseEdit</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
</response>
Example request AddresseGet with functions
<?php
$hash = generateHash();
$xml = "";
$id = "12";
$output_xml = SendRequest("AdresseGet",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example return of an address query
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>AdresseGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>37</id>
<typ>herr,frau,firma</typ>
<marketingsperre />
<trackingsperre>1=keine Mail senden, 0=Mail senden</trackingsperre>
<rechnungsadresse>0=keine gesonderte, 1 = gesonderte Rechnungsadresse</rechnungsadresse>
<sprache>deutsch,englisch</sprache>
<name>Max Muster 2</name>
<abteilung />
<unterabteilung />
<ansprechpartner />
<land />
<strasse>Muster strasse 888</strasse>
<ort />
<plz />
<telefon />
<telefax />
<mobil />
<email />
<ustid />
<ust_befreit>0</ust_befreit>
<passwort_gesendet>0</passwort_gesendet>
<sonstiges />
<adresszusatz />
<kundenfreigabe>0</kundenfreigabe>
<steuer />
<logdatei>2014-06-01 16:01:08</logdatei>
<kundennummer />
<lieferantennummer>70002</lieferantennummer>
<mitarbeiternummer />
<konto />
<blz />
<bank />
<inhaber />
<swift />
<iban />
<waehrung />
<paypal />
<paypalinhaber />
<paypalwaehrung />
<projekt>1</projekt>
<partner>0</partner>
<zahlungsweise />
<zahlungszieltage />
<zahlungszieltageskonto />
<zahlungszielskonto />
<versandart />
<kundennummerlieferant />
<zahlungsweiselieferant />
<zahlungszieltagelieferant />
<zahlungszieltageskontolieferant />
<zahlungszielskontolieferant />
<versandartlieferant />
<geloescht>0</geloescht>
<firma>1</firma>
<webid />
<internetseite />
<vorname />
<kalender_aufgaben />
<titel />
<anschreiben />
<logfile />
<mlmaktiv />
<mlmvertragsbeginn />
<geburtstag />
<liefersperre />
<mlmpositionierung />
<steuernummer />
<steuerbefreit />
<mlmmitmwst />
<mlmabrechnung />
<sponsor />
<geworbenvon />
<liefersperregrund />
<verrechnungskontoreisekosten>0</verrechnungskontoreisekosten>
<rolledatum />
<mlmwaehrungauszahlung />
<mlmfestsetzen>0</mlmfestsetzen>
<mlmmindestpunkte>0</mlmmindestpunkte>
<mlmwartekonto>0.00</mlmwartekonto>
<abweichende_rechnungsadresse>0</abweichende_rechnungsadresse>
<rechnung_vorname />
<rechnung_name />
<rechnung_titel />
<rechnung_typ />
<rechnung_strasse />
<rechnung_ort />
<rechnung_land />
<rechnung_abteilung />
<rechnung_unterabteilung />
<rechnung_adresszusatz />
<rechnung_telefon />
<rechnung_telefax />
<rechnung_anschreiben />
<rechnung_email />
<rechnung_plz />
<rechnung_ansprechpartner />
<kennung />
<zahlungskonditionen_festschreiben />
<rabatte_festschreiben />
<rabattinformation />
<portofreiab />
<portofrei_aktiv />
<provision />
<porto_preis />
<porto_artikelid />
<freifeld1 />
<freifeld2 />
<freifeld3 />
<rechnung_periode />
<rechnung_anzahlpapier />
<rechnung_permail />
<rechnung_email />
</xml>
</response>
Manage orders: AuftragCreate, AuftragEdit, AuftragGet
Orders can be completely managed here, i.e. create new ones (AuftragCreate), edit existing ones (AuftragEdit) or fetch existing ones (AuftragGet) in order to transfer them into another system.
The following parameters can be specified for AuftragCreate:
- <kundennummer> Here NEW can be used for a new customer or the previous customer number of a customer can be used
Data such as payment method, shipping method do not need to be passed. These are basically fetched from the customer master data, unless these are passed to the API.
For AuftragEdit and AuftragGet, the id or orderid (receipt no.) and optionally the project must be passed as a URL. If you want to change an order with AuftragEdit, which already contains positions, you have to enter all positions of the order as well.
Example request AuftragCreate with functions
<?php
$hash = generateHash();
$xml = "<kundennummer>23243</kundennummer>
<artikelliste>
<position>
<nummer>700001</nummer>
<preis>9.99</preis>
<menge>2</menge>
<waehrung>EUR</waehrung>
</position>
<position>
<nummer>700002</nummer>
<preis>3.99</preis>
<menge>1</menge>
<waehrung>EUR</waehrung>
</position>
</artikelliste>";
$output_xml = SendRequest("AuftragCreate",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response AuftragCreate
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>AuftragCreate</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>16</id>
<customernumber>200003</customernumber>
</xml>
</response>
Example request AuftragGet with functions
<?php
$hash = generateHash();
$xml = "";
$id = "14";
$output_xml = SendRequest("AuftragGet",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response AuftragGet
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>AuftragGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>14</id>
<datum>2017-03-16</datum>
<art/>
<projekt>0</projekt>
<belegnr>200002</belegnr>
<internet/>
<bearbeiter>Mitarbeiter</bearbeiter>
<angebot/>
<freitext/>
<internebemerkung/>
<status>freigegeben</status>
<adresse>11</adresse>
<name>Mustersupermarkt</name>
<abteilung/>
<unterabteilung/>
<strasse>Supermarktstraße 1</strasse>
<adresszusatz/>
<ansprechpartner>Herr Supermarktleiter</ansprechpartner>
<plz>12345</plz>
<ort>Supermarktstadt</ort>
<land>DE</land>
<ustid/>
<ust_befreit>0</ust_befreit>
<ust_inner>0</ust_inner>
<email/>
<telefon/>
<telefax/>
<betreff/>
<kundennummer>23241</kundennummer>
<versandart>versandunternehmen</versandart>
<vertrieb>Testfirma GmbH</vertrieb>
<zahlungsweise>rechnung</zahlungsweise>
<zahlungszieltage>14</zahlungszieltage>
<zahlungszieltageskonto>10</zahlungszieltageskonto>
<zahlungszielskonto>2.00</zahlungszielskonto>
<bank_inhaber/>
<bank_institut/>
<bank_blz/>
<bank_konto/>
<kreditkarte_typ/>
<kreditkarte_inhaber/>
<kreditkarte_nummer/>
<kreditkarte_pruefnummer/>
<kreditkarte_monat/>
<kreditkarte_jahr/>
<firma>1</firma>
<versendet>0</versendet>
<versendet_am>0000-00-00 00:00:00</versendet_am>
<versendet_per/>
<versendet_durch/>
<autoversand>1</autoversand>
<keinporto>0</keinporto>
<keinestornomail>0</keinestornomail>
<abweichendelieferadresse>0</abweichendelieferadresse>
<liefername/>
<lieferabteilung/>
<lieferunterabteilung/>
<lieferland/>
<lieferstrasse/>
<lieferort/>
<lieferplz/>
<lieferadresszusatz/>
<lieferansprechpartner/>
<packstation_inhaber/>
<packstation_station/>
<packstation_ident/>
<packstation_plz/>
<packstation_ort/>
<autofreigabe>0</autofreigabe>
<freigabe>0</freigabe>
<nachbesserung>0</nachbesserung>
<gesamtsumme>171.36</gesamtsumme>
<inbearbeitung>0</inbearbeitung>
<abgeschlossen>0</abgeschlossen>
<nachlieferung>0</nachlieferung>
<lager_ok>1</lager_ok>
<porto_ok>1</porto_ok>
<ust_ok>1</ust_ok>
<check_ok>1</check_ok>
<vorkasse_ok>1</vorkasse_ok>
<nachnahme_ok>1</nachnahme_ok>
<reserviert_ok>0</reserviert_ok>
<partnerid>0</partnerid>
<folgebestaetigung>0000-00-00</folgebestaetigung>
<zahlungsmail>0000-00-00</zahlungsmail>
<stornogrund/>
<stornosonstiges/>
<stornorueckzahlung/>
<stornobetrag>0.00</stornobetrag>
<stornobankinhaber/>
<stornobankkonto/>
<stornobankblz/>
<stornobankbank/>
<stornogutschrift>0</stornogutschrift>
<stornogutschriftbeleg/>
<stornowareerhalten>0</stornowareerhalten>
<stornomanuellebearbeitung/>
<stornokommentar/>
<stornobezahlt/>
<stornobezahltam>0000-00-00</stornobezahltam>
<stornobezahltvon/>
<stornoabgeschlossen/>0</stornoabgeschlossen>
<stornorueckzahlungper/>
<stornowareerhaltenretour>0</stornowareerhaltenretour>
<partnerausgezahlt>0</partnerausgezahlt>
<partnerausgezahltam>0000-00-00</partnerausgezahltam>
<kennen/>
<logdatei>2017-03-17 10:30:05</logdatei>
<keinetrackingmail/>
<zahlungsmailcounter/>
<rma>0</rma>
<transaktionsnummer/>
<vorabbezahltmarkieren>0</vorabbezahltmarkieren>
<deckungsbeitragcalc>1</deckungsbeitragcalc>
<deckungsbeitrag>100.00</deckungsbeitrag>
<erloes_netto>144.00</erloes_netto>
<umsatz_netto>144.00</umsatz_netto>
<lieferdatum/>
<tatsaechlicheslieferdatum/>
<liefertermin_ok>1</liefertermin_ok>
<teillieferung_moeglich>0</teillieferung_moeglich>
<kreditlimit_ok>1</kreditlimit_ok>
<kreditlimit_freigabe>0</kreditlimit_freigabe>
<liefersperre_ok>1</liefersperre_ok>
<teillieferungvon>0</teillieferungvon>
<teillieferungnummer>0</teillieferungnummer>
<vertriebid>0</vertriebid>
<aktion/>
<provision>0.00</provision>
<provision_summe/>
<anfrageid>0</anfrageid>
<gruppe>0</gruppe>
<shopextid/>
<shopextstatus/>
<ihrebestellnummer/>
<anschreiben/>
<usereditid>1</usereditid>
<useredittimestamp>2017-03-17 10:30:05</useredittimestamp>
<realrabatt>0.00</realrabatt>
<rabatt>0.00</rabatt>
<einzugsdatum/>
<rabatt1>0.00</rabatt1>
<rabatt2>0.00</rabatt2>
<rabatt3>0.00</rabatt3>
<rabatt4>0.00</rabatt4>
<rabatt5>0.00</rabatt5>
<shop>0</shop>
<steuersatz_normal>19.00</steuersatz_normal>
<steuersatz_zwischen>7.00</steuersatz_zwischen>
<steuersatz_ermaessigt>7.00</steuersatz_ermaessigt>
<steuersatz_starkermaessigt>7.00</steuersatz_starkermaessigt>
<steuersatz_dienstleistung>7.00</steuersatz_dienstleistung>
<waehrung>EUR</waehrung>
<keinsteuersatz/>
<angebotid/>
<schreibschutz>0</schreibschutz>
<pdfarchiviert>0</pdfarchiviert>
<pdfarchiviertversion>0</pdfarchiviertversion>
<typ>firma</typ>
<ohne_briefpapier>0</ohne_briefpapier>
<auftragseingangper/>
<lieferid>0</lieferid>
<ansprechpartnerid>0</ansprechpartnerid>
<systemfreitext/>
<projektfiliale>0</projektfiliale>
<lieferungtrotzsperre>0</lieferungtrotzsperre>
<zuarchivieren>0</zuarchivieren>
<internebezeichnung/>
<angelegtam/>
<saldo>-171.36</saldo>
<saldogeprueft>2017-03-17 10:29:59</saldogeprueft>
<lieferantenauftrag>0</lieferantenauftrag>
<lieferant>0</lieferant>
<lieferdatumkw>0</lieferdatumkw>
<abweichendebezeichnung>0</abweichendebezeichnung>
<rabatteportofestschreiben>0</rabatteportofestschreiben>
<sprache>deutsch</sprache>
<bodyzusatz/>
<bundesland/>
<artikelliste>
<position>
<id>51</id>
<auftrag>14</auftrag>
<artikel>385815</artikel>
<projekt>0</projekt>
<bezeichnung>Kirschjoghurt klein</bezeichnung>
<beschreibung>Ein leckerer kleiner Kirschjogurt.</beschreibung>
<internerkommentar/>
<nummer>115491</nummer>
<menge>50</menge>
<preis>0.30000000</preis>
<waehrung>EUR</waehrung>
<lieferdatum>0000-00-00</lieferdatum>
<vpe>1</vpe>
<sort>1</sort>
<status>angelegt</status>
<umsatzsteuer/>
<bemerkung/>
<geliefert>0</geliefert>
<geliefert_menge>0</geliefert_menge>
<explodiert>0</explodiert>
<explodiert_parent>0</explodiert_parent>
<logdatei>2017-03-17 10:29:59</logdatei>
<punkte>0.00</punkte>
<bonuspunkte>0.00</bonuspunkte>
<mlmdirektpraemie>0.00</mlmdirektpraemie>
<keinrabatterlaubt>0</keinrabatterlaubt>
<grundrabatt>0.00</grundrabatt>
<rabattsync>1</rabattsync>
<rabatt1>0.00</rabatt1>
<rabatt2>0.00</rabatt2>
<rabatt3>0.00</rabatt3>
<rabatt4>0.00</rabatt4>
<rabatt5>0.00</rabatt5>
<einheit/>
<webid/>
<rabatt>0.00</rabatt>
<nachbestelltexternereinkauf/>
<zolltarifnummer/>
<herkunftsland>DE</herkunftsland>
<artikelnummerkunde/>
<freifeld1/>
<freifeld2/>
<freifeld3/>
<freifeld4/>
<freifeld5/>
<freifeld6/>
<freifeld7/>
<freifeld8/>
<freifeld9/>
<freifeld10/>
<lieferdatumkw>0</lieferdatumkw>
<teilprojekt>0</teilprojekt>
</position>
</artikelliste>
</xml>
</response>
Manage articles: ArtikelCreate, ArtikelEdit, ArtikelGet
It is possible to use the API to create new articles (ArtikelCreate), edit articles (ArtikelEdit), and retrieve article information (ArtikelGet). For ArtikelGet and ArtikelEdit it should be noted that the ID of the article is included in the URL via GET by means of &id=. When creating and editing articles all tags can be used, which are available as column in the table "article". However, to get meaningful articles, some tags should at least be set:
- <name_de> name of the product
- <anabregs_text> Description text of the product
- <projekt> Abbreviation of the project. If not set, the default project is chosen
- <nummer> Item number. If a new item number is to be assigned to be entered, NEW must be entered
- <aktiv> 1 or 0, for an active or inactive product respectively
- <variante_von_nummer> number of the product of which the new product is a variant
Example request ArtikelCreate with functions
<?php
$hash = generateHash();
$xml = "<name_de>Kirschjoghurt</name_de>
<anabregs_text>Ein leckerer Kirschjoghurt</anabregs_text>
<nummer>NEW</nummer>
<aktiv>1</aktiv>";
$output_xml = SendRequest("ArtikelCreate",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response ArtikelCreate
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>ArtikelCreate</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>149</id>
<nummer>115491</nummer>
</xml>
</response>
Example request ArtikelEdit with functions
<?php
$hash = generateHash();
$xml = "<nummer>115491</nummer>
<name_de>Kirschjoghurt klein</name_de>
<anabregs_text>Ein leckerer kleiner Kirschjogurt.</anabregs_text>
";
$id = "149";
$output_xml = SendRequest("ArtikelEdit",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response ArtikelEdit
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>ArtikelEdit</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
</response>
Example inventory change with ArtikelEdit
<xml>
<nummer>1000001</nummer>
<lager_platz>HL001B</lager_platz>
<lager_menge>5020</lager_menge>
</xml>
Example request ArtikelGet with functions
<?php
$hash = generateHash();
$xml = "";
$id = 149;
$output_xml = SendRequest("ArtikelGet",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
?>
Example response ArtikelGet
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>ArtikelGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>385815</id>
<typ/>
<nummer>115491</nummer>
<checksum/>
<projekt>0</projekt>
<inaktiv>0</inaktiv>
<ausverkauft>0</ausverkauft>
<warengruppe/>
<name_de>Kirschjoghurt klein</name_de>
<name_en/>
<kurztext_de/>
<kurztext_en/>
<beschreibung_de/>
<beschreibung_en/>
<uebersicht_de/>
<uebersicht_en/>
<links_de/>
<links_en/>
<startseite_de/>
<startseite_en/>
<standardbild/>
<herstellerlink/>
<hersteller/>
<teilbar/>
<nteile/>
<seriennummern/>
<lager_platz/>
<lieferzeit/>
<lieferzeitmanuell/>
<sonstiges/>
<gewicht/>
<endmontage/>
<funktionstest/>
<artikelcheckliste/>
<stueckliste/>
<juststueckliste/>
<barcode/>
<hinzugefuegt/>
<pcbdecal/>
<lagerartikel>0</lagerartikel>
<porto>0</porto>
<chargenverwaltung>0</chargenverwaltung>
<provisionsartikel>0</provisionsartikel>
<gesperrt>0</gesperrt>
<sperrgrund/>
<geloescht>0</geloescht>
<gueltigbis>0000-00-00</gueltigbis>
<umsatzsteuer/>
<klasse/>
<adresse>0</artikel>
<shopartikel>0</shopartikel>
<unishopartikel>0</unishopartikel>
<journalshopartikel>0</journalshopartikel>
<shop>0</shop>
<katalog>0</katalog>
<katalogtext_de/>
<katalogtext_en/>
<katalogbezeichnung_de/>
<katalogbezeichnung_en/>
<neu>0</neu>
<topseller>0</topseller>
<startseite>0</startseite>
<wichtig>0</wichtig>
<mindestlager>0</mindestlager>
<mindestbestellung>0</mindestbestellung>
<partnerprogramm_sperre>0</partnerprogramm_sperre>
<internerkommentar/>
<intern_gesperrt>0</intern_gesperrt>
<intern_gesperrtuser>0</intern_gesperrtuser>
<intern_gesperrtgrund/>
<inbearbeitung>0</inbearbeitung>
<inbearbeitunguser>0</inbearbeitunguser>
<cache_lagerplatzinhaltmenge>-999</cache_lagerplatzinhaltmenge>
<internkommentar/>
<firma>1</firma>
<logdatei>2017-03-24 06:53:10</logdatei>
<anabregs_text>Ein leckerer kleiner Kirschjogurt.</anabregs_text>
<autobestellung>0</autobestellung>
<produktion/>
<herstellernummer/>
<restmenge/>
<mlmdirektpraemie/>
<keineeinzelartikelanzeigen>0</keineeinzelartikelanzeigen>
<mindesthaltbarkeitsdatum>0</mindesthaltbarkeitsdatum>
<letzteseriennummer/>
<individualartikel>0</individualartikel>
<keinrabatterlaubt/>
<rabatt>0</rabatt>
<rabatt_prozent/>
<geraet>0</geraet>
<serviceartikel>0</serviceartikel>
<autoabgleicherlaubt>0</autoabgleicherlaubt>
<pseudopreis/>
<freigabenotwendig>0</freigabenotwendig>
<freigaberegel/>
<nachbestellt/>
<ean/>
<mlmpunkte>0.00</mlmpunkte>
<mlmbonuspunkte>0.00</mlmbonuspunkte>
<mlmkeinepunkteeigenkauf/>
<shop2/>
<shop3/>
<usereditid>1</usereditid>
<useredittimestamp>2017-03-24 06:53:10</useredittimestamp>
<freifeld1/>
<freifeld2/>
<freifeld3/>
<freifeld4/>
<freifeld5/>
<freifeld6/>
<einheit/>
<webid/>
<lieferzeitmanuell_en/>
<variante/>
<variante_von/>
<produktioninfo/>
<sonderaktion/>
<sonderaktion_en/>
<autolagerlampe>0</autolagerlampe>
<leerfeld/>
<zolltarifnummer/>
<herkunftsland>DE</herkunftsland>
<laenge>0.00</laenge>
<breite>0.00</breite>
<hoehe>0.00</hoehe>
<gebuehr>0</gebuehr>
<pseudolager/>
<matrixprodukt>0</matrixprodukt>
<anabregs_text_en>
<externeproduktion>0</externeproduktion>
<bildvorschau/>
<inventursperre>0</inventursperre>
<variante_kopie>0</variante_kopie>
<unikat>0</unikat>
<downloadartikel>0</downloadartikel>
<generierenummerbeioption>0</generierenummerbeioption>
<allelieferanten>0</allelieferanten>
<tagespreise>0</tagespreise>
<rohstoffe>0</rohstoffe>
<steuer_erloese_inland_normal/>
<steuer_aufwendung_inland_normal/>
<steuer_erloese_inland_ermaessigt/>
<steuer_aufwendung_inland_ermaessigt/>
<steuer_erloese_inland_steuerfrei/>
<steuer_aufwendung_inland_steuerfrei/>
<steuer_erloese_inland_innergemeinschaftlich/>
<steuer_aufwendung_inland_innergemeinschaftlich/>
<steuer_erloese_inland_eunormal/>
<steuer_erloese_inland_nichtsteuerbar/>
<steuer_erloese_inland_euermaessigt/>
<steuer_aufwendung_inland_nichtsteuerbar/>
<steuer_aufwendung_inland_eunormal/>
<steuer_aufwendung_inland_euermaessigt/>
<steuer_erloese_inland_export/>
<steuer_aufwendung_inland_import/>
<steuer_art_produkt>1</steuer_art_produkt>
<steuer_art_produkt_download>1</steuer_art_produkt_download>
<metadescription_de/>
<metadescription_en/>
<metakeywords_de/>
<metakeywords_en/>
<vkmeldungunterdruecken>0</vkmeldungunterdruecken>
<freifeld7/>
<freifeld8/>
<freifeld9/>
<freifeld10/>
<ursprungsregion/>
<altersfreigabe/>
<provisionssperre/>
<inventurekaktiv>0</inventureaktiv>
<inventurek/>
<verkaufspreise>
<staffelpreis>
<ab_menge>1</ab_menge>
<preis>0.30000000</preis>
<vpe/>
<waehrung>EUR</waehrung>
</staffelpreis>
</verkaufspreise>
</xml>
</response>
Manage users: BenutzerCreate, BenutzerEdit, BenutzerGet
BenutzerCreate can be used to create a new user. If a user is to be be edited, this is done with BenutzerEdit. BenutzerGet returns information of a user. With BenutzerEdit and BenutzerGet the ID of the user must be passed as a GET parameter.
When creating or editing a user, there are a few things to keep in mind:
- <active> Must be set to 1, otherwise the user will not be able to log in
- <startseite> The URL of the startpage (e.g. index.php?module=welcome&action=pinwand) must be base54 encoded
- <passwordmd5> The user's password must be specified here md5 encoded, not <password>. <password> is from older versions, is no longer used and serves only historical purposes
Tags to create or edit a user:
- <adresse> Contains the ID of the address
- <username> Must not already exist
- <type> Type of user, e.g. admin or default
- <aktiv> Set to 1
- <startseite> Must be base54 encoded
- <passwordmd5> Must be md5 encoded
Example request BenutzerCreate with functions
<?php
$hash = generateHash();
$xml = "<adresse>12</adresse>
<username>Musterbenutzer</username>
<type>admin</type>
<activ>1</activ>
<passwordmd5>e22a63fb76874c99488435f26b117e37</passwordmd5>
<externlogin>1</externlogin>";
$output_xml = SendRequest("BenutzerCreate",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Beispiel Antwort BenutzerCreate
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>BenutzerCreate</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>10</id>
</xml>
</response>
Example response BenutzerCreate
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>BenutzerCreate</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>10</id>
</xml>
</response>
Example request BenutzerEdit with functions
<?php
$hash = generateHash();
$xml = "<type>standard</type>
<activ>1</activ>
<passwordmd5>dafe3d37f46376f08f8e92b15e308239</passwordmd5>
<externlogin>0</externlogin>";
$id = 10;
$output_xml = SendRequest("BenutzerEdit",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response BenutzerEdit
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>BenutzerEdit</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
</response>
Example request BenutzerGet with functions
<?php
$hash = generateHash();
$xml = "";
$id = "1";
$output_xml = SendRequest("BenutzerGet",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response BenutzerGet
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>BenutzerGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>1</id>
<username>admin</username>
<password>MAiwwHrOSf9kg</password>
<repassword>0</repassword>
<description />
<settings>a:2:{s:18:"lohnabrechnung_von";s:0:"";s:18:"lohnabrechnung_bis";s:0:"";}</settings>
<parentuser />
<activ>1</activ>
<type>admin</type>
<adresse>1</adresse>
<fehllogins>0</fehllogins>
<standarddrucker>0</standarddrucker>
<firma>1</firma>
<logdatei>2014-05-26 11:12:28</logdatei>
<startseite>aW5kZXgucGhwP21vZHVsZT13ZWxjb21lJmFjdGlvbj1waW53YW5k</startseite>
<hwtoken>0</hwtoken>
<hwkey />
<hwcounter>0</hwcounter>
<motppin />
<motpsecret />
<externlogin>1</externlogin>
<hwdatablock />
<passwordmd5 />
<internebezeichnung />
<gpsstechuhr>0</gpsstechuhr>
<kalender_passwort />
<kalender_aktiv />
</xml>
</response>
Example Request BenutzerGetRFID
<?php
$xml = '<rfid>1234</rfid>';
$output_xml = SendRequest('BenutzerGetRFID', $xml);
echo "<pre>";
var_dump($output_xml);
echo "</pre>";
function SendRequest($methodname,$xml)
{
$url = 'http://localhost/xentral/20.1/www/api/'.$methodname;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "apitest:password1234");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '<xml>'.$xml.'</xml>');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['content-type: application/xml']);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Example response BenutzerGetRFID
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>BenutzerGetRFID</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>3</id>
<username>demomitarbeiter</username>
<password>pllIX0pw7JU9c</password>
<repassword>0</repassword>
<description></description>
<settings>a:6:
{s:16:"pos_list_projekt";s:1:"0";s:18:"pos_list_kassierer";s:1:"0";s:22:"pos_list_kassierername";s:1:"0";s:18:"pos_list_lkadresse";s:1:"0";s:18:"lohnabrechnung_von";s:0:"";s:18:"lohnabrechnung_bis";s:0:"";}
</settings>
<parentuser>0</parentuser>
<activ>1</activ>
<type>standard</type>
<adresse>6</adresse>
<fehllogins>0</fehllogins>
<standarddrucker>0</standarddrucker>
<firma>1</firma>
<logdatei>2019-11-22 16:54:00</logdatei>
<startseite></startseite>
<hwtoken>0</hwtoken>
<hwkey></hwkey>
<hwcounter>0</hwcounter>
<motppin></motppin>
<motpsecret></motpsecret>
<passwordmd5>2ad71933e4b074c4671425c8e6b48021</passwordmd5>
<externlogin>0</externlogin>
<projekt_bevorzugen>0</projekt_bevorzugen>
<email_bevorzugen>1</email_bevorzugen>
<projekt>0</projekt>
<rfidtag>1234</rfidtag>
<vorlage></vorlage>
<kalender_passwort></kalender_passwort>
<kalender_ausblenden>0</kalender_ausblenden>
<kalender_aktiv>0</kalender_aktiv>
<gpsstechuhr>0</gpsstechuhr>
<standardetikett>0</standardetikett>
<standardfax>0</standardfax>
<internebezeichnung></internebezeichnung>
<hwdatablock></hwdatablock>
<standardversanddrucker>0</standardversanddrucker>
<passwordsha512></passwordsha512>
<salt></salt>
<paketmarkendrucker>0</paketmarkendrucker>
<sprachebevorzugen>deutsch</sprachebevorzugen>
<vergessencode></vergessencode>
<vergessenzeit></vergessenzeit>
<chat_popup>1</chat_popup>
<defaultcolor>false</defaultcolor>
<passwordhash></passwordhash>
<docscan_aktiv>0</docscan_aktiv>
<docscan_passwort></docscan_passwort>
<callcenter_notification>1</callcenter_notification>
<stechuhrdevice></stechuhrdevice>
</xml>
</response>
Manage groups: GruppeCreate, GruppeEdit, GruppeGet
The GruppeCreate command can be used to create a new group. To edit a group, GruppeEdit is used. However, if only the data of a group is to be done, use GruppeGet. For GruppeEdit and GruppeCreate the ID of the group must be passed as GET parameter.
Tags to create or edit a group: You can use as tag the column captions of the table groups from the database can be chosen as tag, e.g.:
- <name> Contains the name of the group
- <art> Group should be entered here
- <kennziffer> Any code number to recognize the group
Example request GruppeCreate with functions
<?php
$hash = generateHash();
$xml = "<name>Messe 2017</name>
<art>Gruppe</art>
<kennziffer>2017</kennziffer>";
$output_xml = SendRequest("GruppeCreate",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response GruppeCreate
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>GruppeCreate</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>8</id>
</xml>
</response>
Example request GruppeEdit with functions
<?php
$hash = generateHash();
$xml = "<name>Messe 2016</name>
<kennziffer>2016</kennziffer>";
$id = 8;
$output_xml = SendRequest("GruppeEdit",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response GruppeEdit
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>GruppeEdit</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
</response>
Example request GruppeGet with functions
<?php
$hash = generateHash();
$xml = "";
$id = 2;
$output_xml = SendRequest("GruppeGet",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response GruppeGet
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>GruppeGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>2</id>
<name>Händler</name>
<art>gruppe</art>
<kennziffer>1</kennziffer>
<internebemerkung/>
<grundrabatt>0.00</grundrabatt>
<rabatt1>0.00</rabatt1>
<rabatt2>0.00</rabatt2>
<rabatt3>0.00</rabatt3>
<rabatt4>0.00</rabatt4>
<rabatt5>0.00</rabatt5>
<sonderrabatt_skonto>0.00</sonderrabatt_skonto>
<provision>0.00</provision>
<kundennummer/>
<partnerid/>
<dta_aktiv>0</dta_aktiv>
<dta_periode>1</dta_periode>
<dta_dateiname/>
<dta_mail/>
<dta_mail_betreff/>
<dta_mail_text/>
<dtavariablen/>
<dta_variante>1</dta_variante>
<bonus1>0.00</bonus1>
<bonus1_ab>0.00</bonus1_ab>
<bonus2>0.00</bonus2>
<bonus2_ab>0.00</bonus2_ab>
<bonus3>0.00</bonus3>
<bonus3_ab>0.00</bonus3_ab>
<bonus4>0.00</bonus4>
<bonus4_ab>0.00</bonus4_ab>
<bonus5>0.00</bonus5>
<bonus5_a>0.00</bonus5_ab>
<bonus6>0.00</bonus6>
<bonus6_ab>0.00</bonus6_ab>
<bonus7>0.00</bonus7>
<bonus7_ab>0.00</bonus7_ab>
<bonus8>0.00</bonus8>
<bonus8_ab>0.00</bonus8_ab>
<bonus9>0.00</bonus9>
<bonus9_ab>0.00</bonus9_ab>
<bonus10>0.00</bonus10>
<bonus10_ab>0.00</bonus10_ab>
<zahlungszieltage>0</zahlungszieltage>
<zahlungszielskonto>0.00</zahlungszielskonto>
<zahlungszieltageskonto>0</zahlungszieltageskonto>
<portoartikel>0</portoartikel>
<portofreiab>0.00</portofreiab>
<erweiterteoptionen>0</erweiterteoptionen>
<zentralerechnung>0</zentralerechnung>
<zentralregulierung>0</zentralregulierung>
<gruppe>0</gruppe>
<preisgruppe>0</preisgruppe>
<verbandsgruppe>0</verbandsgruppe>
<rechnung_name/>
<rechnung_strasse/>
<rechnung_ort/>
<rechnung_plz/>
<rechnung_abteilung/>
<rechnung_land/>
<rechnung_email/>
<rechnung_periode>1</rechnung_periode>
<rechnung_anzahlpapier>0</rechnung_anzahlpapier>
<rechnung_permail>0</rechnung_permail>
<webid/>
<portofrei_aktiv>0.00</portofrei_aktiv>
<projekt>0</projekt>
<objektname/>
<objekttyp/>
<parameter/>
<objektname2/>
<objekttyp2/>
<parameter2/>
<objektname3/>
<objekttyp3/>
<parameter3/>
<kategorie>1</kategorie>
</xml>
</response>
Creating and editing prices of an item: PreiseEdit
With PreiseEdit there is the possibility to create new purchase and sales prices, as well as edit existing purchase and sales prices. For the exact XML structure, the example call of the PreiseEdit function can be seen below.
Basic structure of the XML data:
<artikel>
<id/>
<nummer/>
<verkaufspreise>
<staffelpreis/>
</verkaufspreise>
<einkaufspreise>
<staffelpreis/>
</einkaufspreise>
</artikel>
The tag <artikel> encloses all other tags. To assign the prices, the ID of the product must be specified. As of version 17.3, the item number, can be used instead of the ID. Then comes the tag <verkaufspreise> / <einkaufspreise>, which then contains the tag <staggerprice>. Within <staffelpreis> there are further parameters as listed in the next paragraph. For each price, a new tag <staffelpreis> must be created within <verkaufspreise> / <einkaufspreise>.
The following parameters are available:
Sales prices:
- <kundennummer> if price is for all and not customer specific, then <customernumber> leave blank
- <gruppe> ID of the group from xentral, if price for specific groups applies. Otherwise <gruppe> leave blank
- <ab_menge> Specifies the quantity from which the price should be valid. If <ab_menge> is empty, 1 is taken as the quantity. Decimal numbers with dot specify, e.g. 2.50
- <preis> selling price, must be specified with point, e.g. 29.99
Purchase prices:
- <lieferantennummer> must be filled, otherwise the purchase price will be not created / processed
- <ab_menge> Specifies the quantity from which the price should be valid. If <ab_menge> is empty, 1 is taken as the quantity. Decimal numbers with dot specify, e.g. 2.50
- <bestellnummer> Order number of the item from the supplier
- <bezeichnunglieferant> Designation of the article at the supplier
- <preis> purchase price, must be specified with point, eg 29.99
- <waehrung> currency of the price, if <waehrung> is empty, EUR is taken as currency
Example request PreiseEdit with functions
<?php
$hash = generateHash();
$xml = "<artikel>
<id>7</id>
<verkaufspreise>
<staffelpreis>
<kundennummer>100030</kundennummer>
<gruppe/>
<ab_menge>1</ab_menge>
<preis>2.80</preis>
</staffelpreis>
<staffelpreis>
<kundennummer/>
<gruppe/>
<ab_menge/>
<preis>2.40</preis>
</staffelpreis>
</verkaufspreise>
<einkaufspreise>
<staffelpreis>
<lieferantennummer>70003</lieferantennummer>
<ab_menge/>
<bestellnummer>123456789</bestellnummer>
<bezeichnunglieferant>Artikel 54367B</bezeichnunglieferant>
<preis>1.20</preis>
<waehrung/>
</staffelpreis>
</einkaufspreise>
</artikel>
";
$output_xml = SendRequest("PreiseEdit",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/17.4/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response PreiseEdit
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>PreiseEdit</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
</response>
Manage additional contact information of an address: AddresseKontaktCreate, AddresseKontaktEdit, AddresseKontaktGet
AddresseKontaktCreate can be used to add additional contact information to an address. These are edited with AddresseKontaktEdit. If a Contact information come back, this happens with AddresseKontaktGet.
Possible parameters for creating and editing an address information:
- <addresse> ID of the address for the contact information
- <bezeichnung> Designation of the contact information, e.g. phone private
- <kontakt> Content of the contact information, e.g. a phone number
Example request AddresseKontaktCreate with functions
<?php
$hash = generateHash();
$xml = "<adresse>13</adresse>
<bezeichnung>Telefon privat</bezeichnung>
<kontakt>01234567890</kontakt>";
$output_xml = SendRequest("AdresseKontaktCreate",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response AddresseKontaktCreate
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>AdresseKontaktCreate</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>2</id>
</xml>
</response>
Example request AddresseKontaktEdit with functions
<?php
$hash = generateHash();
$xml = "<bezeichnung>Mobil privat</bezeichnung>
<kontakt>01232222222</kontakt>";
$id = 2;
$output_xml = SendRequest("AdresseKontaktEdit",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response AddresseKontaktEdit
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>AdresseKontaktEdit</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
</response>
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>AdresseKontaktGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<adresse>41</adresse>
<bezeichnung>Skype Account</bezeichnung>
<kontakt>123456789</kontakt>
</xml>
</response>
Requests from receipts (Offer to delivery note: BelegeList)
To retrieve information from receipts, the function BelegeList can be used. Tags that can be used for a query within <order>. Can be used: only 1 within possible. Allowed sorting criteria: anabregs_text, anabregs_text_en, artikelkategorie, belegnr, betrag, bezeichnung, datum, land, letztes_datum, menge, name, name_de, name_en, nummer, ort, plz, preis, status, strasse, telefax, telefon
<desc> 1 or 0 possible to sort in ascending or descending order.
Tags that can be used for a query below <order>, to narrow the search for specific items:
- <beleg> The following vouchers are possible: order, invoice, quotation, delivery bill, credit note
- <addresse> ID of the desired address from which vouchers are displayed
- <datum_von> Date from which vouchers should be selected
- <datum_bis> Date until which the vouchers should be selected
- <groupbyartikel> 1 or 0 to group by article or not
- <groupbyadresse> 1 or 0 to group by addresses or not
- <groupbyposition> 1 or 0 to group by positions or not
- <kategorie> ID of the item category
- <kategoriename> name of the item category
- <limit> Specify number to limit the output of the documents, e.g.. <limit>10</limit> displays only the first 10 receipts
- <offset> Displays vouchers starting from the specified number, e.g. <offset>10</offset>, Displays from the 10th voucher the vouchers
- <status> specify status of desired vouchers, such as released or sent
Example request with functions 1
<?php
$hash = generateHash();
$xml = "<order>
<field>name_de</field>
<desc>1</desc>
</order>
<beleg>rechnung</beleg>
<groupbyartikel>1</groupbyartikel>
<limit>10</limit>
<offset>0</offset>";
$output_xml = SendRequest("BelegeList",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
?>
Example response after query 1
<response>
<status>
<action>BelegeList</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<artikel_list>
<artikel>
<id>
<value>1</value>
</id>
<nummer>
<value>700001</value>
</nummer>
<name_de>
<value>Apfelmus</value>
</name_de>
<menge>
<value>3</value>
</menge>
<betrag>
<value>2,50</value>
</betrag>
<artikelkategorie>
<value>produkt</value>
</artikelkategorie>
<letztes_datum>
<value>2016-10-19</value>
</letztes_datum>
<artikelkategoriebezeichnung>
<value />
</artikelkategoriebezeichnung>
</artikel>
<anz_gesamt>1</anz_gesamt>
<anz_result>1</anz_result>
</artikel_list>
</xml>
</response>
Example receipts request for article input 2
<order>
<field>name_de</field>
<desc>1</desc>
</order>
<beleg>rechnung</beleg>
<groupbyartikel>1</groupbyartikel>
<limit>10</limit>
<offset>0</offset>
Response to query 2
<response>
<status>
<action>BelegeList</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<artikel_list>
<artikel>
<id>
<value>29549</value>
</id>
<nummer>
<value>6450823</value>
</nummer>
<name_de>
<value>Testartoleö</value>
</name_de>
<menge>
<value>1</value>
</menge>
<betrag>
<value>0</value>
</betrag>
<artikelkategorie>
<value>1289_kat</value>
</artikelkategorie>
<letztes_datum>
<value>2016-04-26</value>
</letztes_datum>
<artikelkategoriebezeichnung>
<value>Testkategorie</value>
</artikelkategoriebezeichnung>
</artikel>
<artikel>
<id>
<value>1388</value>
</id>
<nummer>
<value>123456</value>
</nummer>
<name_de>
<value>Akkuschrauber</value>
</name_de>
<menge>
<value>1</value>
</menge>
<betrag>
<value>94.0252</value>
</betrag>
<artikelkategorie>
<value>produkt</value>
</artikelkategorie>
<letztes_datum>
<value>2016-10-25</value>
</letztes_datum>
<artikelkategoriebezeichnung>
<value/>
</artikelkategoriebezeichnung>
</artikel>
<artikel>
..
</artikel>
<anz_gesamt>365</anz_gesamt>
<anz_result>30</anz_result>
</artikel_list>
</xml>
</response>
Example: items for a delivery note based on the receipt number
$input_xml = '<beleg>lieferschein</beleg>
<search>
<field>belegnr</field>
<suche>'.base64_encode(300080).'</suche>
<exakt>1</exakt>
</search>';
$xml = SendRequest($url,"BelegeList",$input_xml,$hash,"", $api_id);
Response
<response>
<status>
<action>BelegeList</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<beleg_list>
<lieferschein>
<belegid>
<value>125</value>
</belegid>
<datum>
<value>2016-10-27</value>
</datum>
<belegnr>
<value>300080</value>
</belegnr>
<status>
<value>versendet</value>
</status>
<adresse>
<value>655</value>
</adresse>
<name>
<value>TEST KUNDE</value>
</name>
<position>
<beleg>
<value>lieferschein</value>
</beleg>
<adresse>
<value>655</value>
</adresse>
<name>
<value>TEST KUNDE</value>
</name>
<datum>
<value>2016-10-27</value>
</datum>
<belegnr>
<value>300080</value>
</belegnr>
<belegid>
<value>125</value>
</belegid>
<id>
<value>178</value>
</id>
<lieferschein>
<value>125</value>
</lieferschein>
<artikel>
<value>36370</value>
</artikel>
<projekt>
<value>1</value>
</projekt>
<bezeichnung>
<value>Artikelname</value>
</bezeichnung>
<beschreibung>
<value>foobar</value>
</beschreibung>
<internerkommentar>
<value/>
</internerkommentar>
<nummer>
<value>A123</value>
</nummer>
<seriennummer>
<value>100002</value>
</seriennummer>
<menge>
<value>2</value>
</menge>
<lieferdatum>
<value>0000-00-00</value>
</lieferdatum>
<vpe>
<value>1</value>
</vpe>
<sort>
<value>1</value>
</sort>
<status>
<value>versendet</value>
</status>
<bemerkung>
<value/>
</bemerkung>
<geliefert>
<value>2</value>
</geliefert>
<abgerechnet>
<value>0</value>
</abgerechnet>
<logdatei>
<value>2016-10-27 09:23:59</value>
</logdatei>
<explodiert_parent_artikel>
<value>0</value>
</explodiert_parent_artikel>
<einheit>
<value/>
</einheit>
<zolltarifnummer>
<value/>
</zolltarifnummer>
<herkunftsland>
<value>DE</value>
</herkunftsland>
<artikelnummerkunde>
<value/>
</artikelnummerkunde>
<lieferdatumkw>
<value>0</value>
</lieferdatumkw>
<auftrag_position_id>
<value>1734</value>
</auftrag_position_id>
<lagertext>
<value/>
</lagertext>
<kostenlos>
<value>0</value>
</kostenlos>
<teilprojekt>
<value>0</value>
</teilprojekt>
<freifeld1>
<value/>
</freifeld1>
<freifeld2>
<value/>
</freifeld2>
<freifeld3>
<value/>
</freifeld3>
<freifeld4>
<value/>
</freifeld4>
<freifeld5>
<value/>
</freifeld5>
<freifeld6>
<value/>
</freifeld6>
<freifeld7>
<value/>
</freifeld7>
<freifeld8>
<value/>
</freifeld8>
<freifeld9>
<value/>
</freifeld9>
<freifeld10>
<value/>
</freifeld10>
<explodiert_parent>
<value>0</value>
</explodiert_parent>
<artikelkategorie>
<value>1331_kat</value>
</artikelkategorie>
<preis>
<value>0</value>
</preis>
</position>
</lieferschein>
<anz_gesamt>1</anz_gesamt>
<anz_result>1</anz_result>
</beleg_list>
</xml>
</response>
Requests for sales: AddresseListeGet
AddresseListeGet can be used to output customers who, for example, within a certain period of time have generated a certain amount of sales.
The query of customers can be narrowed down with some parameters:
- <order> includes the tag <field>. This will make your result sorted by the field in <field>
- <field> is inside <order> and can contain various filters such as <field>name</field>. Possible are: groupname, code, name, zip, city, phone, fax, contact person, type, street, country, email, customer number, supplier number
- <desc> is inside <order>. If a 1 is set. Your result will be sorted in descending order according to your specification of <field>. If a 0 the same ascending
- <limit> limits the result of your query to your specified number, e.g. <limit>10</limit> displays only the first 10 receipts
- <offset> displays the vouchers starting from the specified number, e.g. <offset>10</offset>, displays the vouchers from the 10th voucher
- <kategorie> Here the category ID must be specified. If a receipt contains an item from this item category, the total turnover is displayed
- <vertrieb> The ID of the sales employee must be specified here. The sales of these vouchers with this sales employee are summed up
- <summierung> contains the various tags of the document types whose Turnover should be totaled. Possible are:
- <rechnung>
- <gutschrift>
- <bestellung>
- <auftrag>
- <angebot>
- <umsatzvon> indicates the minimum turnover that must be present
- <status> Here you can specify the status, which the receipts must meet. If no <status> is specified, canceled and created receipts not included
- <datumvon> From this date the receipts will be included.
- <datumbis> Up to this date the receipts will be considered
- <searchmode> Here AND or OR can be specified to link the individual link conditions. If nothing is specified, AND is used
- <exakt> Here 1 or 0 must be specified, whether the conditions at LIKE should be enclosed by % or not. 1 means with % (e.g. LIKE. %condition%), 0 means without (e.g. LIKE condition).
- <search> contains the tags <suche> and <field>. In <suche> must be passed with base64_encode() the value to search for, such as a such as a specific customer name (<suche>.base64_encode('testname').</suche>). With <field> then the database field from the address table is named, in which the term from <suche> should be searched (<field>name</field>)
- <id> By specifying the address ID, the query can be limited to this address
Example 1 query AddresseListeGet with functions
$input_xml = "
<order>
<field>name</field><desc>0</desc>
</order>
<limit>10</limit>
<offset>0</offset>
<summierung>
<beleg>rechnung</beleg>
<beleg>gutschrift</beleg>
</summierung>
<umsatzvon>100</umsatzvon>
<datumbis>2016-09-08</datumbis>
<datumvon>2015-03-08</datumvon>
";
$xml = SendRequest($url,"AdresseListeGet",$input_xml,$hash,"", $api_id);
Example 1 response AddresseListeGet
<response>
<status>
<action>AdresseListeGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<adressen>
<adresse>
<id>
<value>1085</value>
</id>
<typ/>
<marketingsperre/>
<trackingsperre>
<value>0</value>
</trackingsperre>
<rechnungsadresse>
<value>0</value>
</rechnungsadresse>
<sprache/>
<name>
<value>Testkunde</value>
</name>
<abteilung/>
<unterabteilung/>
<ansprechpartner/>
<land>
<value>DE</value>
</land>
<strasse>
<value>Musterstr. 1</value>
</strasse>
<ort>
<value>Musterstadt</value>
</ort>
<plz>
<value>12345</value>
</plz>
<telefon/>
<telefax/>
<mobil/>
<email>
<value>email@example.com</value>
</email>
<ustid/>
<ust_befreit>
<value>0</value>
</ust_befreit>
<passwort_gesendet>
<value>0</value>
</passwort_gesendet>
<sonstiges/>
<adresszusatz/>
<kundenfreigabe>
<value>0</value>
</kundenfreigabe>
<steuer/>
<logdatei>
<value>2016-09-23 12:01:26</value>
</logdatei>
<kundennummer>
<value>10476</value>
</kundennummer>
<lieferantennummer/>
<mitarbeiternummer/>
<konto/>
<blz/>
<bank/>
<inhaber/>
<swift/>
<iban/>
<waehrung/>
<paypal/>
<paypalinhaber/>
<paypalwaehrung/>
<projekt>
<value>1</value>
</projekt>
<partner>
<value>0</value>
</partner>
<zahlungsweise/>
<zahlungszieltage/>
<zahlungszieltageskonto/>
<zahlungszielskonto/>
<versandart/>
<kundennummerlieferant/>
<zahlungsweiselieferant/>
<zahlungszieltagelieferant/>
<zahlungszieltageskontolieferant/>
<zahlungszielskontolieferant/>
<versandartlieferant/>
<geloescht>
<value>0</value>
</geloescht>
<firma>
<value>1</value>
</firma>
<webid/>
<vorname/>
<kennung/>
<sachkonto/>
<freifeld1/>
<freifeld2/>
<freifeld3/>
<filiale/>
<vertrieb/>
<innendienst/>
<verbandsnummer/>
<abweichendeemailab/>
<portofrei_aktiv/>
<portofreiab>
<value>0.00</value>
</portofreiab>
<infoauftragserfassung/>
<mandatsreferenz/>
<mandatsreferenzdatum/>
<mandatsreferenzaenderung>
<value>0</value>
</mandatsreferenzaenderung>
<glaeubigeridentnr/>
<kreditlimit>
<value>0.00</value>
</kreditlimit>
<tour>
<value>0</value>
</tour>
<zahlungskonditionen_festschreiben/>
<rabatte_festschreiben/>
<mlmaktiv/>
<mlmvertragsbeginn/>
<mlmlizenzgebuehrbis/>
<mlmfestsetzenbis/>
<mlmfestsetzen>
<value>0</value>
</mlmfestsetzen>
<mlmmindestpunkte>
<value>0</value>
</mlmmindestpunkte>
<mlmwartekonto>
<value>0.00</value>
</mlmwartekonto>
<abweichende_rechnungsadresse>
<value>0</value>
</abweichende_rechnungsadresse>
<rechnung_vorname/>
<rechnung_name/>
<rechnung_titel/>
<rechnung_typ/>
<rechnung_strasse/>
<rechnung_ort/>
<rechnung_plz/>
<rechnung_ansprechpartner/>
<rechnung_land/>
<rechnung_abteilung/>
<rechnung_unterabteilung/>
<rechnung_adresszusatz/>
<rechnung_telefon/>
<rechnung_telefax/>
<rechnung_anschreiben/>
<rechnung_email/>
<geburtstag/>
<rolledatum/>
<liefersperre/>
<liefersperregrund/>
<mlmpositionierung/>
<steuernummer/>
<steuerbefreit/>
<mlmmitmwst/>
<mlmabrechnung/>
<mlmwaehrungauszahlung/>
<mlmauszahlungprojekt>
<value>0</value>
</mlmauszahlungprojekt>
<sponsor/>
<geworbenvon/>
<logfile/>
<kalender_aufgaben/>
<verrechnungskontoreisekosten>
<value>0</value>
</verrechnungskontoreisekosten>
<usereditid/>
<useredittimestamp>
<value>0000-00-00 00:00:00</value>
</useredittimestamp>
<rabatt/>
<provision/>
<rabattinformation/>
<rabatt1/>
<rabatt2/>
<rabatt3/>
<rabatt4/>
<rabatt5/>
<internetseite/>
<bonus1/>
<bonus1_ab/>
<bonus2/>
<bonus2_ab/>
<bonus3/>
<bonus3_ab/>
<bonus4/>
<bonus4_ab/>
<bonus5/>
<bonus5_ab/>
<bonus6/>
<bonus6_ab/>
<bonus7/>
<bonus7_ab/>
<bonus8/>
<bonus8_ab/>
<bonus9/>
<bonus9_ab/>
<bonus10/>
<bonus10_ab/>
<rechnung_periode/>
<rechnung_anzahlpapier/>
<rechnung_permail/>
<titel/>
<anschreiben/>
<nachname/>
<arbeitszeitprowoche>
<value>0.00</value>
</arbeitszeitprowoche>
<folgebestaetigungsperre>
<value>0</value>
</folgebestaetigungsperre>
<verein_mitglied_seit/>
<verein_mitglied_bis/>
<verein_mitglied_aktiv/>
<verein_spendenbescheinigung>
<value>0</value>
</verein_spendenbescheinigung>
<freifeld4/>
<freifeld5/>
<freifeld6/>
<freifeld7/>
<freifeld8/>
<freifeld9/>
<freifeld10/>
<rechnung_papier>
<value>0</value>
</rechnung_papier>
<angebot_cc/>
<auftrag_cc/>
<rechnung_cc/>
<gutschrift_cc/>
<lieferschein_cc/>
<bestellung_cc/>
<angebot_fax_cc/>
<auftrag_fax_cc/>
<rechnung_fax_cc/>
<gutschrift_fax_cc/>
<lieferschein_fax_cc/>
<bestellung_fax_cc/>
<abperfax>
<value>0</value>
</abperfax>
<abpermail/>
<kassiereraktiv>
<value>0</value>
</kassiereraktiv>
<kassierernummer/>
<kassiererprojekt>
<value>0</value>
</kassiererprojekt>
<portofreilieferant_aktiv>
<value>0</value>
</portofreilieferant_aktiv>
<portofreiablieferant>
<value>0.00</value>
</portofreiablieferant>
<mandatsreferenzart/>
<mandatsreferenzwdhart/>
<serienbrief>
<value>0</value>
</serienbrief>
<lieferantennummerbeikunde/>
<lead>
<value>0</value>
</lead>
<geburtstagkalender>
<value>0</value>
</geburtstagkalender>
<zahlungsweiseabo/>
<bundesland/>
<liefersperredatum/>
<mandatsreferenzhinweis/>
<geburtstagskarte>
<value>0</value>
</geburtstagskarte>
<kundennummer_buchhaltung/>
<lieferantennummer_buchhaltung/>
<mlmintranetgesamtestruktur>
<value>0</value>
</mlmintranetgesamtestruktur>
<rechnung_umsatz_netto>
<value>1219.24</value>
</rechnung_umsatz_netto>
<gutschrift_umsatz_netto/>
</adresse>
<adresse>
...
</adresse>
<anz_gesamt>6771</anz_gesamt>
<anz_result>10</anz_result>
</adressen>
</xml>
</response>
Example 2 Request AddresseListeGet with functions
<?php
$hash = generateHash();
$xml = "<order>
<field>name</field>
<desc>0</desc>
</order>
<limit>10</limit>
<offset>0</offset>
<summierung>
<beleg>rechnung</beleg>
</summierung>
<umsatzvon>2800</umsatzvon>
<search>
<suche>".base64_encode('86150')."</suche>
<field>plz</field>
</search>
";
$output_xml = SendRequest("AdresseListeGet",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/17.4/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example 2 response AddresseListeGet
<response>
<status>
<action>AdresseListeGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<adressen>
<adresse>
<id>
<value>1085</value>
</id>
<typ/>
<marketingsperre/>
<trackingsperre>
<value>0</value>
</trackingsperre>
<rechnungsadresse>
<value>0</value>
</rechnungsadresse>
<sprache/>
<name>
<value>Testkunde</value>
</name>
<abteilung/>
<unterabteilung/>
<ansprechpartner/>
<land>
<value>DE</value>
</land>
<strasse>
<value>Musterstr. 1</value>
</strasse>
<ort>
<value>Musterstadt</value>
</ort>
<plz>
<value>86150</value>
</plz>
<telefon/>
<telefax/>
<mobil/>
<email>
<value>email@example.com</value>
</email>
<ustid/>
<ust_befreit>
<value>0</value>
</ust_befreit>
<passwort_gesendet>
<value>0</value>
</passwort_gesendet>
<sonstiges/>
<adresszusatz/>
<kundenfreigabe>
<value>0</value>
</kundenfreigabe>
<steuer/>
<logdatei>
<value>2016-09-23 12:01:26</value>
</logdatei>
<kundennummer>
<value>10476</value>
</kundennummer>
<lieferantennummer/>
<mitarbeiternummer/>
<konto/>
<blz/>
<bank/>
<inhaber/>
<swift/>
<iban/>
<waehrung/>
<paypal/>
<paypalinhaber/>
<paypalwaehrung/>
<projekt>
<value>1</value>
</projekt>
<partner>
<value>0</value>
</partner>
<zahlungsweise/>
<zahlungszieltage/>
<zahlungszieltageskonto/>
<zahlungszielskonto/>
<versandart/>
<kundennummerlieferant/>
<zahlungsweiselieferant/>
<zahlungszieltagelieferant/>
<zahlungszieltageskontolieferant/>
<zahlungszielskontolieferant/>
<versandartlieferant/>
<geloescht>
<value>0</value>
</geloescht>
<firma>
<value>1</value>
</firma>
<webid/>
<vorname/>
<kennung/>
<sachkonto/>
<freifeld1/>
<freifeld2/>
<freifeld3/>
<filiale/>
<vertrieb/>
<innendienst/>
<verbandsnummer/>
<abweichendeemailab/>
<portofrei_aktiv/>
<portofreiab>
<value>0.00</value>
</portofreiab>
<infoauftragserfassung/>
<mandatsreferenz/>
<mandatsreferenzdatum/>
<mandatsreferenzaenderung>
<value>0</value>
</mandatsreferenzaenderung>
<glaeubigeridentnr/>
<kreditlimit>
<value>0.00</value>
</kreditlimit>
<tour>
<value>0</value>
</tour>
<zahlungskonditionen_festschreiben/>
<rabatte_festschreiben/>
<mlmaktiv/>
<mlmvertragsbeginn/>
<mlmlizenzgebuehrbis/>
<mlmfestsetzenbis/>
<mlmfestsetzen>
<value>0</value>
</mlmfestsetzen>
<mlmmindestpunkte>
<value>0</value>
</mlmmindestpunkte>
<mlmwartekonto>
<value>0.00</value>
</mlmwartekonto>
<abweichende_rechnungsadresse>
<value>0</value>
</abweichende_rechnungsadresse>
<rechnung_vorname/>
<rechnung_name/>
<rechnung_titel/>
<rechnung_typ/>
<rechnung_strasse/>
<rechnung_ort/>
<rechnung_plz/>
<rechnung_ansprechpartner/>
<rechnung_land/>
<rechnung_abteilung/>
<rechnung_unterabteilung/>
<rechnung_adresszusatz/>
<rechnung_telefon/>
<rechnung_telefax/>
<rechnung_anschreiben/>
<rechnung_email/>
<geburtstag/>
<rolledatum/>
<liefersperre/>
<liefersperregrund/>
<mlmpositionierung/>
<steuernummer/>
<steuerbefreit/>
<mlmmitmwst/>
<mlmabrechnung/>
<mlmwaehrungauszahlung/>
<mlmauszahlungprojekt>
<value>0</value>
</mlmauszahlungprojekt>
<sponsor/>
<geworbenvon/>
<logfile/>
<kalender_aufgaben/>
<verrechnungskontoreisekosten>
<value>0</value>
</verrechnungskontoreisekosten>
<usereditid/>
<useredittimestamp>
<value>0000-00-00 00:00:00</value>
</useredittimestamp>
<rabatt/>
<provision/>
<rabattinformation/>
<rabatt1/>
<rabatt2/>
<rabatt3/>
<rabatt4/>
<rabatt5/>
<internetseite/>
<bonus1/>
<bonus1_ab/>
<bonus2/>
<bonus2_ab/>
<bonus3/>
<bonus3_ab/>
<bonus4/>
<bonus4_ab/>
<bonus5/>
<bonus5_ab/>
<bonus6/>
<bonus6_ab/>
<bonus7/>
<bonus7_ab/>
<bonus8/>
<bonus8_ab/>
<bonus9/>
<bonus9_ab/>
<bonus10/>
<bonus10_ab/>
<rechnung_periode/>
<rechnung_anzahlpapier/>
<rechnung_permail/>
<titel/>
<anschreiben/>
<nachname/>
<arbeitszeitprowoche>
<value>0.00</value>
</arbeitszeitprowoche>
<folgebestaetigungsperre>
<value>0</value>
</folgebestaetigungsperre>
<verein_mitglied_seit/>
<verein_mitglied_bis/>
<verein_mitglied_aktiv/>
<verein_spendenbescheinigung>
<value>0</value>
</verein_spendenbescheinigung>
<freifeld4/>
<freifeld5/>
<freifeld6/>
<freifeld7/>
<freifeld8/>
<freifeld9/>
<freifeld10/>
<rechnung_papier>
<value>0</value>
</rechnung_papier>
<angebot_cc/>
<auftrag_cc/>
<rechnung_cc/>
<gutschrift_cc/>
<lieferschein_cc/>
<bestellung_cc/>
<angebot_fax_cc/>
<auftrag_fax_cc/>
<rechnung_fax_cc/>
<gutschrift_fax_cc/>
<lieferschein_fax_cc/>
<bestellung_fax_cc/>
<abperfax>
<value>0</value>
</abperfax>
<abpermail/>
<kassiereraktiv>
<value>0</value>
</kassiereraktiv>
<kassierernummer/>
<kassiererprojekt>
<value>0</value>
</kassiererprojekt>
<portofreilieferant_aktiv>
<value>0</value>
</portofreilieferant_aktiv>
<portofreiablieferant>
<value>0.00</value>
</portofreiablieferant>
<mandatsreferenzart/>
<mandatsreferenzwdhart/>
<serienbrief>
<value>0</value>
</serienbrief>
<lieferantennummerbeikunde/>
<lead>
<value>0</value>
</lead>
<geburtstagkalender>
<value>0</value>
</geburtstagkalender>
<zahlungsweiseabo/>
<bundesland/>
<liefersperredatum/>
<mandatsreferenzhinweis/>
<geburtstagskarte>
<value>0</value>
</geburtstagskarte>
<kundennummer_buchhaltung/>
<lieferantennummer_buchhaltung/>
<mlmintranetgesamtestruktur>
<value>0</value>
</mlmintranetgesamtestruktur>
<rechnung_umsatz_netto>
<value>3400.87</value>
</rechnung_umsatz_netto>
</adresse>
<anz_gesamt>1</anz_gesamt>
<anz_result>1</anz_result>
</adressen>
</xml>
</response>
Manage files: DateiList, DateiHeader, DateiDownload
DateiList can be used to display files that are located in xentral. There are two parameters to choose from:
- <parameter> Corresponds here to the ID of the respective object
- <objekt> Here must be specified from which object the files come, such as addresses, order or invoice. Should already uploaded files are to be downloaded again, this can be implemented in combination of DateiHeader and DateiDownload
Example request DateiList with functions
<?php
$hash = generateHash();
$xml = "<parameter>1</parameter>
<objekt>Adressen</objekt>";
$output_xml = SendRequest("DateiList",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response DateiList
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>DateiList</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<Datei>
<titel>Arbeitsnachweis Testfirma GmbH von 2017-02-23 bis 2017-02-23</titel>
<subjekt>anhang</subjekt>
<version>1</version>
<ersteller>Testfirma GmbH</ersteller>
<bemerkung>Initiale Version</Bemerkung>
<datum>2017-03-23</datum>
<id>16</id>
</Datei>
<Datei>
<titel>Arbeitsnachweis Testfirma GmbH von 2017-02-22 bis 2017-02-22</titel>
<subjekt>anhang</subjekt>
<version>1</version>
<ersteller>Testfirma GmbH</ersteller>
<bemerkung>Initiale Version</bemerkung>
<datum>2017-03-22</datum>
<id>17</id>
</Datei>
</xml>
</response>
Example request DateiHeader + DateiDownload with functions
<?php
$hash = generateHash();
$xml = "";
$id = 20;
$headera = explode("\n",file_get_contents('http://192.168.0.28/wawision/16.3/www/index.php?module=api&action=DateiHeader&hash='.$hash.'&id='.$id));
foreach($headera as $head){
header($head);
}
echo file_get_contents('http://192.168.0.28/wawision/16.3/www/index.php?module=api&action=DateiDownload&hash='.$hash.'&id='.$id);
exit;
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
Example response DateiHeader + DateiDownload
The typical window for opening or saving files opens.
Managing files: BelegPDFHeader, BelegPDF
DateiList can be used to display files that are located in xentral. There are two parameters to choose from here:
- <parameter> Corresponds here to the ID of the respective object
- <objekt> Here you must specify from which object you want the files, such as addresses, order or invoice
If files that have already been uploaded are to be downloaded again, this can be done be implemented in combination of DateiHeader and DateiDownload.
Example request BelegPDFHeader + BelegPDF with functions
<?php
$hash = generateHash();
$xml = "";
$id = 20;
$beleg='rechnung';
$headera = explode("\n",file_get_contents('http://192.168.0.28/wawision/18.3/www/index.php?module=api&action=BelegPDFHeader&hash='.$hash.'&id='.$id.'&beleg='.$beleg));
foreach($headera as $head){
header($head);
}
echo file_get_contents('http://192.168.0.28/wawision/18.3/www/index.php?module=api&action=BelegPDF&hash='.$hash.'&id='.$id.'&beleg='.$beleg);
exit;
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
Example response BelegPDFHeader + BelegPDF
The typical window for opening or saving files opens.
Special functions of special modules
XML product quotas
There are two ways to query the quotas: With and without the parameters as well as from and to. Without the two parameters, the product quota appears from today's date. With the parameters a list appears with the the booked products in the time range of orders that have the "released" status.
Example Request ArtikelkontingenteGet
<?php
include("../api.php");
include("../config.php");
global $remotedomain,$initkey,$url;
$hash = generateHash($initkey,$remotedomain);
$nummer = "700245";
$von = "2015-07-01";
$bis = "2015-07-20";
header('Content-Type: application/xml; charset=utf-8');
echo SendRequest($url,"ArtikelkontingenteGet","",$hash,"&nummer=".$nummer."&von=".$von."&bis=".$bis);
Example response ArtikelkontingenteGet
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>ArtikelkontingenteGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<artikelkontingente>
<kontingent>
<gebucht>103</gebucht>
<menge>11.00</menge>
<datum>2015-07-13</datum>
</kontingent>
<kontingent>
<gebucht>5</gebucht>
<menge>5.00</menge>
<datum>2015-07-17</datum>
</kontingent>
</artikelkontingente>
</xml>
Request data from export templates: ExportVorlageGet
To be able to query data from export templates, an export template must already be created (instructions for export templates). Available data that can be retrieved:
- Addresses
- Offers
- Orders
- Contact persons
- Articles
- Credit notes
- Invoices
- Delivery notes
- Orders
- Quotation items
- Order items
- Credit memo items
- Invoice items
- Delivery note items
- Purchase order items
In order for the data to be accessible via the API, the checkbox API release must be activated in the edit mode of the desired Export template the hook API release must be activated.
Also in the edit mode of the export template, the CSV label checkbox must be must be activated, so that the column names are used as XML tag names, because otherwise the output as XML will not work.
There are several GET parameters to choose from here to query the data:
- id → Corresponds here to the ID of the respective export template (mandatory field)
- von → Date specification (in the format dd.mm.yy), as of when the desired data should be retrieved (optional). Available for quotations, orders, credit notes, Invoices, delivery bills, orders and their positions
- bis → date specification (in the format dd.mm.yy), until when the desired data should be queried (optional). Available for quotations, orders, credit notes, Invoices, delivery bills, orders and their positions
- projekt → Returns only the data for the matching project (optional). Available For addresses, quotations, orders, articles, credit bills, invoices, delivery bills, Purchase orders and their associated line items
Which export template values are returned depends on the specified CSV fields in the export template.
Example request ExportVorlageGet with functions
<?php
$hash = generateHash();
$xml = "";
$id = "1";
$projekt = "";
$von = "";
$bis = "";
$output_xml = SendRequest("ExportVorlageGet",$xml,$hash,$id,$projekt,$von,$bis);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id,$projekt,$von,$bis)
{
$url = 'http://192.168.0.28/wawision/16.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id.'&projekt='.$projekt.'&von='.$von.'&bis='.$bis;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response ExportVorlageGet for product
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>ExportVorlageGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<items>
<item>
<nummer>1000001</nummer>
<name_de>Tastatur</name_de>
<name_en/>
<beschreibung_de/>
<beschreibung_en/>
<kurztext_de/>
<kurztext_en/>
<internerkommentar/>
<hersteller/>
<herstellernummer/>
<herstellerlink/>
<ean/>
<systemid>1</systemid>
</item>
<item>
<nummer>1000002</nummer>
<name_de>Tasten</name_de>
<name_en/>
<beschreibung_de/>
<beschreibung_en/>
<kurztext_de/>
<kurztext_en/>
<internerkommentar/>
<hersteller/>
<herstellernummer/>
<herstellerlink/>
<ean/>
<systemid>2</systemid>
</item>
<item>
<nummer>1000003</nummer>
<name_de>USB Maus</name_de>
<name_en/>
<beschreibung_de/>
<beschreibung_en/>
<kurztext_de/>
<kurztext_en/>
<internerkommentar/>
<hersteller/>
<herstellernummer/>
<herstellerlink/>
<ean/>
<systemid>3</systemid>
</item>
</items>
</xml>
</response>
Request data from reports: BerichteGet
BerichteGet returns the result of the SQL query from the structure field of a report.
Returns the result of the SQL query from the structure field of a report. To do this, the ID of the report must be passed as a GET parameter.
Example query BerichteGet with functions
<?php
$hash = generateHash();
$xml = "";
$id = "1";
$output_xml = SendRequest("BerichteGet",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/17.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response BerichteGet
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>BerichteGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<items>
<item>
<name>Kunde 1</name>
<kundennummer>10000</kundennummer>
</item>
<item>
<name>Kunde 2</name>
<kundennummer>10001</kundennummer>
</item>
</items>
</xml>
</response>
Request data from products using filters: ArtikelList
ArtikelList returns as a result all the product information for the products that match your search criteria.
The following parameters are available:
- Inside the <order> tag, you can specify the <field> tag. Inside <field> is the column caption from the product table of the database, with which the result can be sorted
- For this purpose, also within the tag <order> the tag <desc> can be specified. If 1 is sorted in descending order, if 0 is sorted in ascending order. If desc> is not specified, the sorting will be in ascending order according to the field sorted that was specified in <field>
- The <limit> tag can be used to limit the listing of results to a specified number be limited
- The tag <offset> can only be used in combination with <limit> to limit your listing of results to a specific number. For example, <limit>shows 10</limit> and <offset>0</offset> all entries from 0 to 10
- In addition to the above tags, as a tag can be any column caption from the product table of the database can be used as a tag to further restrict the search, e.g. searches <name_de>screw</name_de> for the products, that contain in the name screw
Example request ArtikelList with functions
<?php
$hash = generateHash();
$xml = "<order>
<field>name_de</field>
<desc>1</desc>
</order>
<limit>10</limit>
<offset>0</offset>
<name_de>Apfel</name_de>
";
$id = "";
$output_xml = SendRequest("ArtikelList",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/17.4/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response ArtikelList
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>ArtikelList</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<items>
<item>
<id>7</id>
<typ>produkt</typ>
<nummer>1000006</nummer>
<checksum/>
<projekt>1</projekt>
<inaktiv/>
<ausverkauft>0</ausverkauft>
<warengruppe/>
<name_de>Apfelkuchen</name_de>
<name_en/>
<kurztext_de/>
<kurztext_en/>
<beschreibung_de/>
<beschreibung_en/>
<uebersicht_de/>
<uebersicht_en/>
<links_de/>
<links_en/>
<startseite_de/>
<startseite_en/>
<standardbild/>
<herstellerlink/>
<hersteller/>
<teilbar/>
<nteile/>
<seriennummern>keine</seriennummern>
<lager_platz>1</lager_platz>
<lieferzeit/>
<lieferzeitmanuell/>
<sonstiges/>
<gewicht/>
<endmontage/>
<funktionstest/>
<artikelcheckliste/>
<stueckliste>1</stueckliste>
<juststueckliste>0</stueckliste>
<barcode/>
<hinzugefuegt/>
<pcbdecal/>
<lagerartikel>1</lagerartikel>
<porto>0</porto>
<chargenverwaltung>0</chargenverwaltung>
<provisionsartikel>0</provisionsartikel>
<gesperrt>0</gesperrt>
<sperrgrund/>
<geloescht>0</geloescht>
<gueltigbis>0000-00-00</gueltigbis>
<umsatzsteuer>normal</normal>
<klasse/>
<adresse>0</adresse>
<shopartikel>0</shopartikel>
<unishopartikel>0</unishopartikel>
<journalshopartikel>0</journalshopartikel>
<shop>0</shop>
<katalog>0</katalog>
<katalogtext_de/>
<katalogtext_en/>
<katalogbezeichnung_de/>
<katalogbezeichnung_en/>
<neu>0</neu>
<topseller>0</topseller>
<startseite>0</startseite>
<wichtig>0</wichtig>
<mindestlager>0</mindestlager>
<mindestbestellung>0</mindestbestellung>
<partnerprogramm_sperre>0</partnerprogramm_sperre>
<internerkommentar/>
<intern_gesperrt>0</intern_gesperrt>
<intern_gesperrtuser>0</intern_gesperrtuser>
<intern_gesperrtgrund/>
<inbearbeitung>0</inbearbeitung>
<inbearbeitunguser>0</inbearbeitunguser>
<cache_lagerplatzinhaltmenge>0</cache_lagerplatzinhaltmenge>
<internkommentar/>
<firma>1</firma>
<logdatei>2017-10-18 08:27:17</logdatei>
<anabregs_text>Ein Apfelkuchen</anabregs_text>
<autobestellung>0</autobestellung>
<produktion>0</produktion>
<herstellernummer>A232</herstellernummer>
<restmenge>0</restmenge>
<mlmdirektpraemie>0.00</mlmdirektpraemie>
<keineeinzelartikelanzeigen>0</keineeinzelartikelanzeigen>
<mindesthaltbarkeitsdatum>0</mindesthaltbarkeitsdatum>
<letzteseriennummer/>
<individualartikel>0</individualartikel>
<keinrabatterlaubt>0</keinrabatterlaubt>
<rabatt>0</rabatt>
<rabatt_prozent>0.00</rabatt_prozent>
<geraet>0</geraet>
<serviceartikel>0</serviceartikel>
<autoabgleicherlaubt>0</autoabgleicherlaubt>
<pseudopreis>0.00</pseudopreis>
<freigabenotwendig>0</freigabenotwendig>
<freigaberegel/>
<nachbestellt>0</nachbestellt>
<ean/>
<mlmpunkte>0.00</mlmpunkte>
<mlmbonuspunkte>0.00</mlmbonuspunkte>
<mlmkeinepunkteeigenkauf>0</mlmkeinepunkteeigenkauf>
<shop2>0</shop2>
<shop3>0</shop3>
<usereditid>1</usereditid>
<useredittimestamp>2017-10-18 08:27:17</useredittimestamp>
<freifeld1/>
<freifeld2/>
<freifeld3/>
<freifeld4/>
<freifeld5/>
<freifeld6/>
<einheit/>
<webid/>
<lieferzeitmanuell_en/>
<variante>0</variante>
<variante_von>0</variante_von>
<produktioninfo/>
<sonderaktion/>
<sonderaktion_en>
<autolagerlampe>0</autolagerlampe>
<leerfeld/>
<zolltarifnummer/>
<herkunftsland/>
<laenge>0.00</laenge>
<breite>0.00</breite>
<hoehe>0.00</hoehe>
<gebuehr>0</gebuehr>
<pseudolager/>
<downloadartikel>0</downloadartikel>
<matrixprodukt>0</matrixprodukt>
<steuer_erloese_inland_normal/>
<steuer_aufwendung_inland_normal/>
<steuer_erloese_inland_ermaessigt/>
<steuer_aufwendung_inland_ermaessigt/>
<steuer_erloese_inland_steuerfrei/>
<steuer_aufwendung_inland_steuerfrei/>
<steuer_erloese_inland_innergemeinschaftlich/>
<steuer_aufwendung_inland_innergemeinschaftlich/>
<steuer_erloese_inland_eunormal/>
<steuer_erloese_inland_nichtsteuerbar/>
<steuer_erloese_inland_euermaessigt/>
<steuer_aufwendung_inland_nichtsteuerbar/>
<steuer_aufwendung_inland_eunormal/>
<steuer_aufwendung_inland_euermaessigt/>
<steuer_erloese_inland_export/>
<steuer_aufwendung_inland_import/>
<steuer_art_produkt>0</steuer_art_produkt>
<steuer_art_produkt_download>0</steuer_art_produkt_download>
<metadescription_de/>
<metadescription_en/>
<metakeywords_de/>
<metakeywords_en/>
<anabregs_text_en/>
<externeproduktion>0</externeproduktion>
<bildvorschau/>
<inventursperre>0</inventursperre>
<variante_kopie>0</variante_kopie>
<unikat>0</unikat>
<generierenummerbeioption>0</generierenummerbeioption>
<allelieferanten>0</allelieferanten>
<tagespreise>0</tagespreise>
<rohstoffe>0</rohstoffe>
<provisionssperre>0</provisionssperre>
<dienstleistung>0</dienstleistung>
<inventurekaktiv>0</inventurekaktiv>
<inventurek>0.00000000</inventurek>
<hinweis_einfuegen/>
<steuertext_innergemeinschaftlich/>
<steuertext_export/>
<formelmenge/>
<formelpreis/>
<freifeld7/>
<freifeld8/>
<freifeld9/>
<freifeld10/>
<freifeld11/>
<freifeld12/>
<freifeld13/>
<freifeld14/>
<freifeld15/>
<freifeld16/>
<freifeld17/>
<freifeld18/>
<freifeld19/>
<freifeld20/>
<ursprungsregion/>
<bestandalternativartikel>0</bestandalternativartikel>
<metatitle_de/>
<metatitle_en/>
<vkmeldungunterdruecken>0</vkmeldungunterdruecken>
<altersfreigabe/>
<unikatbeikopie>0</unikatbeikopie>
<steuergruppe>0</steuergruppe>
<keinskonto>0</keinskonto>
<berechneterek>0.0000</berechneterek>
<verwendeberechneterek>0</verwendeberechneterek>
<berechneterekwaehrung/>
</item>
</items>
</xml>
</response>
Manage accounts: AccountCreate (version 18.3 and later), AccountEdit (version 18.3 and later), AddresseAccountsGet
With AccountCreate a new account can be created within an address, which can also be edited with AccountEdit.
All database fields from the address_accounts table are available as parameters:
- <aktiv> indicates whether an account is currently active (1) or inactive (0) is
- <adresse> is the address ID of the address to which this account belongs
- <bezeichnung> is the designation for this account, e.g. Login Account
- <art> is the type of an account, e.g. database, SSH
- <url> is the URL to the respective account, if any
- <benutzername> is the username for this account
- <passwort> is the password for this account
- <gueltig_ab> indicates from when this account is valid
- <gueltig_bis> specifies until when this account is valid
- <email> here the appropriate email address can be entered
- <notiz> notes can be entered here
Mandatory fields to create an account with AccountCreate are <adresse> and <bezeichnung>.
To use AccountEdit, the ID of the account must be specified as the Get parameter.
AddresseAccountsGet returns all active accounts of a given address. For this, the address ID and optionally the type of account must be passed as a Get parameter.
Example request AccountCreate with functions
<?php
$hash = generateHash();
$xml = "<adresse>3</adresse>
<bezeichnung>Datenbank Login</bezeichnung>
<aktiv>1</aktiv>
<art>db</art>
<url>http://192.168.0.28/meinedatenbank</url>
<benutzername>mustermannmax</benutzername>
<passwort>123456</passwort>
<gueltig_ab>20.08.2018</gueltig_ab>
<gueltig_bis>20.08.2019</gueltig_bis>
<email>maxmustermann@maxmustermann.de</email>
<notiz>Datenbank Login zu Testsystem</notiz>";
$output_xml = SendRequest("AccountCreate",$xml,$hash);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash)
{
$url = 'http://192.168.0.28/wawision/18.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response AccountCreate
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>AccountCreate</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>2</id>
</xml>
</response>
Example request AccountEdit with functions
<?php
$hash = generateHash();
$xml = "<bezeichnung>Datenbank Login MySQL</bezeichnung>
<aktiv>0</aktiv>
<art>db mysql</art>
<url>http://192.168.0.28/meinedatenbank</url>
<benutzername>mustermannmaxsql</benutzername>
<passwort>123456sql</passwort>
<gueltig_ab>26.09.2018</gueltig_ab>
<gueltig_bis>31.12.2019</gueltig_bis>
<email>maxmustermann@maxmustermann.de</email>
<notiz>Datenbank Login zu MySQL DB</notiz>";
$id = "2";
$output_xml = SendRequest("AccountEdit",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/18.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response AccountEdit
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>AccountEdit</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
</response>
Example request AddresseAccountsGet with functions
<?php
$hash = generateHash();
$xml = "";
$id = 3;
$output_xml = SendRequest("AdresseAccountsGet",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/18.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response AddresseAccountsGet
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>AdresseAccountsGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<adresse_accounts>
<account>
<id>2</id>
<aktiv>1</aktiv>
<adresse>3</adresse>
<bezeichnung>Datenbank Login</bezeichnung>
<art>db</art>
<url>http://192.168.0.28/meinedatenbank</url>
<benutzername>mustermannmax</benutzername>
<passwort>123456</passwort>
<webid>0</webid>
<gueltig_ab>2018-08-20</gueltig_ab>
<gueltig_bis>2019-08-20</gueltig_bis>
<email>maxmustermann@maxmustermann.de</email>
<notiz>Datenbank Login zu Testsystem</notiz>
</account>
</adresse_accounts>
</xml>
</response>
Other ways to use the API
Assign time tracking to an employee
Starting with version 19.2, there is an option to create a time entry via the API:
address
If the ID of the address for which the time recording is to be created is known, this can be passed in the field adresse_abrechnung.
Example request ZeiterfassungCreate with address
<?php
$hash = generateHash();
$xml = "<adresse>1</adresse>
<adresse_abrechnung>1</adresse_abrechnung>
<von>2017-01-01 12:00:00</von>
<bis>2017-01-01 14:15:00</bis>
<aufgabe>Hallo</aufgabe>";
$id = "2";
$output_xml = SendRequest("ZeiterfassungCreate",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/18.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response ZeiterfassungCreate with address
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>ZeiterfassungCreate</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
</response>
employee number
Starting with version 19.3, there are options to use the API to create a time tracking for a specific employee number.
Example Request ZeiterfassungCreate with Employee Number
<?php
$hash = generateHash();
$xml = "<mitarbeiternummer>90002</mitarbeiternummer>
<von>2017-01-01 12:00:00</von>
<bis>2017-01-01 14:15:00</bis>
<aufgabe>Hallo</aufgabe>";
$id = "2";
$output_xml = SendRequest("ZeiterfassungCreate",$xml,$hash,$id);
function generateHash()
{
$initKey = 'neijfj38734hujfie';
$remoteDomain = 'http://192.168.0.28';
$date = gmdate('dmY');
$hash = "";
for($i = 0; $i <= 200; $i++)
$hash = sha1($hash . $initKey . $remoteDomain . $date);
return $hash;
}
function SendRequest($methodname,$xml,$hash,$id)
{
$url = 'http://192.168.0.28/wawision/18.3/www/index.php?module=api&action='.$methodname.'&hash='.$hash.'&id='.$id;
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<request>
<status>
<function>'.$methodname.'</function>
</status>
<xml>'.$xml.'</xml>
</request>';
$data = array('xml' => $xml, 'md5sum' => md5($xml));
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
$obj = simplexml_load_string($output_xml);
echo "<pre>";
print_r($obj);
echo "</pre>";
?>
Example response ZeiterfassungCreate with employee number
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>ZeiterfassungCreate</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
</response>
Mark invoice as paid
Starting with version 20.1, there is an option to use the API to mark invoices as paid.
Example Request RechnungAlsBezahltMarkieren
<?php
$xml = '<id>6</id>';
$output_xml = SendRequest('RechnungAlsBezahltMarkieren', $xml);
echo "<pre>";
var_dump($output_xml);
echo "</pre>";
function SendRequest($methodname,$xml)
{
$url = 'http://localhost/xentral/20.1/www/api/'.$methodname;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "apitest:password1234");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '<xml>'.$xml.'</xml>');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['content-type: application/xml']);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Example response RechnungAlsBezahltMarkieren
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action></action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>6</id>
</xml>
</response>
Complete order
As of version 20.1, an order can be completed via the API.
Example request AuftragAbschliessen
<?php
$xml = '<id>2</id>';
$output_xml = SendRequest('AuftragAbschliessen', $xml);
echo "<pre>";
var_dump($output_xml);
echo "</pre>";
function SendRequest($methodname,$xml)
{
$url = 'http://localhost/xentral/20.1/www/api/'.$methodname;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "apitest:password1234");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '<xml>'.$xml.'</xml>');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['content-type: application/xml']);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Example response AuftragAbschliessen
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action></action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>2</id>
</xml>
</response>
Release receipts
Starting with version 20.1, there is an option to release receipts via the API. This applies to the document types offer, order, invoice, delivery note, purchase order and credit note. The call is the same for all document types, only the function name changes.
Example based on an order
<?php
$xml = '<id>2</id>';
$output_xml = SendRequest('AuftragFreigabe', $xml);
echo "<pre>";
var_dump($output_xml);
echo "</pre>";
function SendRequest($methodname,$xml)
{
$url = 'http://localhost/xentral/20.1/www/api/'.$methodname;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "apitest:password1234");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '<xml>'.$xml.'</xml>');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['content-type: application/xml']);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Example response AuftragAbschliessen
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action></action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>8</id>
<belegnr>200007</belegnr>
</xml>
</response>
Submit receipts
Starting with version 20.1, there is an option to send receipts via the API. This applies to offer, order confirmation, invoice, delivery note and credit note. The call is the same for all document types, only the function name changes.
Example request AuftragVersenden
<?php
$xml = '<id>8</id>
<versandart>email</versandart>
<drucker>1</drucker>';
$output_xml = SendRequest('AuftragVersenden', $xml);
echo "<pre>";
var_dump($output_xml);
echo "</pre>";
function SendRequest($methodname,$xml)
{
$url = 'http://localhost/xentral/20.1/www/api/'.$methodname;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "apitest:password1234");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '<xml>'.$xml.'</xml>');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['content-type: application/xml']);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Example response AuftragVersenden
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action></action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>8</id>
</xml>
</response>
Continue order as invoice
Starting with version 20.1, there is an option to continue orders as an invoice via the API.
Example request WeiterfuehrenAuftragZuRechnung
<?php
$xml = '<id>10</id>';
$output_xml = SendRequest('WeiterfuehrenAuftragZuRechnung', $xml);
echo "<pre>";
var_dump($output_xml);
echo "</pre>";
function SendRequest($methodname,$xml)
{
$url = 'http://localhost/xentral/20.1/www/api/'.$methodname;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "apitest:password1234");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '<xml>'.$xml.'</xml>');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['content-type: application/xml']);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Example response WeiterfuehrenAuftragZuRechnung
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action></action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>18</id>
</xml>
</response>
Continue invoice as credit note
Starting with version 20.1, there is an option to carry forward invoices as credit notes via the API.
Example request WeiterfuehrenRechnungZuGutschrift
<?php
$xml = '<id>1</id>';
$output_xml = SendRequest('WeiterfuehrenRechnungZuGutschrift', $xml);
echo "<pre>";
var_dump($output_xml);
echo "</pre>";
function SendRequest($methodname,$xml)
{
$url = 'http://localhost/xentral/20.1/www/api/'.$methodname;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "apitest:password1234");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '<xml>'.$xml.'</xml>');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['content-type: application/xml']);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Example response WeiterfuehrenRechnungZuGutschrift
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action></action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<id>4</id>
</xml>
</response>
Query clock status
The current status of an employee at the time clock can be queried using the ID of the time clock and the employee's address ID can be retrieved.
Example Request StechuhrStatusGet
<?php
$xml = '<id>1</id>
<adresse>6</adresse>';
$output_xml = SendRequest('StechuhrstatusGet', $xml);
echo "<pre>";
var_dump($output_xml);
echo "</pre>";
function SendRequest($methodname,$xml)
{
$url = 'http://localhost/xentral/20.1/www/api/'.$methodname;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "apitest:password1234");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '<xml>'.$xml.'</xml>');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['content-type: application/xml']);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Example response StechuhrStatusGet
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>StechuhrStatusGet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<status>pausestart</status>
<seit>0.08</seit>
<dd>0</dd>
<kommen>0</kommen>
</xml>
</response>
Change time clock status
An employee's current status on the time clock can be changed with the new status and the user's ID or the employee's address can be set. Which status can be set depends on the current status:
- If current status = 'going': Only status 'come' can be set
- If current status = 'coming': Only status 'going' or 'pausestart' can be be set
- If current status = 'pausestart': Only status 'pausestop' can be set be
Example request time StechuhrStatusSet
<?php
$xml = '<cmd>pausestop</cmd>
<adresse>6</adresse>';
$output_xml = SendRequest('StechuhrstatusSet', $xml);
echo "<pre>";
var_dump($output_xml);
echo "</pre>";
function SendRequest($methodname,$xml)
{
$url = 'http://localhost/xentral/20.1/www/api/'.$methodname;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "apitest:password1234");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '<xml>'.$xml.'</xml>');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['content-type: application/xml']);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Example response time StechuhrStatusSet
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>StechuhrStatusSet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
</response>
Example Request StechuhrSummary
<?php
$xml = '<adresse>6</adresse>';
$output_xml = SendRequest('StechuhrSummary', $xml);
echo "<pre>";
var_dump($output_xml);
echo "</pre>";
function SendRequest($methodname,$xml)
{
$url = 'http://localhost/xentral/20.1/www/api/'.$methodname;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD, "apitest:password1234");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, '<xml>'.$xml.'</xml>');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['content-type: application/xml']);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
?>
Example response StechuhrSummary
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status>
<action>StechuhrStatusSet</action>
<message>OK</message>
<messageCode>1</messageCode>
</status>
<xml>
<mitarbeiter_adresse type="documentary">6</mitarbeiter_adresse>
<ZeitRequest>2019-11-25T10:17:01+01:00</ZeitRequest>
<UrlaubSoll>0</UrlaubSoll>
<UrlaubIst>0</UrlaubIst>
<UeberstundenMonat>0.00</UeberstundenMonat>
<UeberstundenGesamt>0.00</UeberstundenGesamt>
<KW>1</KW>
<Einzelauflistung>
<Kalenderwoche>
<KW>48</KW>
<Arbeitstag>
<Datum>25.11.2019</Datum>
<ArbeitszeitSoll>0</ArbeitszeitSoll>
<ArbeitszeitIst>0.25</ArbeitszeitIst>
<ArbeitsEvents>
<Event>
<typ>kommen</typ>
<zeit>08:00</zeit>
</Event>
<Event>
<typ>pausestart</typ>
<zeit>12:30</zeit>
</Event>
<Event>
<typ>pausestop</typ>
<zeit>13:30</zeit>
</Event>
<Event>
<typ>gehen</typ>
<zeit>17:00</zeit>
</Event>
</ArbeitsEvents>
</Arbeitstag>
<Arbeitstag>
<Datum>26.11.2019</Datum>
<ArbeitszeitSoll>0</ArbeitszeitSoll>
<ArbeitszeitIst>0</ArbeitszeitIst>
<ArbeitsEvents/>
</Arbeitstag>
[...]
</Kalenderwoche>
</Einzelauflistung>
</xml>
</response>
Updated note: New API accounts as of version 20.3
Starting with version 20.3, every API account must also be provided with permissions. These must always be set. When updating from version 20.2 to version 20.3 the API account has been transferred from the basic settings has been transferred to the API Accounts app.
Migrated the API Accounts from the basic settings to the API Accounts module. Here you do not need any further customization of the call.
If you already use an API account from the API Account module and use the Call without the API ID parameter, please make the following adjustment. :
For this call (/www/index.php?module=api&action=AddressGet&hash={hash}&id={address-id}) the parameter &api_id={api_id} is also required. Here "id" must be replaced with the ID of the API to be used, e.g. "api_id=1" or "api_id=2".
Converting the API call via hash
Background
There are several ways to address the xentral API. In the first variant, the following call was used:
URL.com/index.php?module=api&action=UserList&hash=
This was tailored to the API account from the basic settings, which could be further distinguished via IDs or similar.
Then, with version 20.1, the custom module for API accounts was implemented and additionally a new parameter "api_id" was added, which in combination with the hash ensures that the requests are also called/handled via the correct API account. are called/handled by the correct API account. As the parameter name suggests, this is the ID of the API account.
This parameter is required as mandatory since version 20.3. Without it, the calls will be accompanied by the error message "wrong hash".
How do I use this parameter correctly?
Here you need to pass the ID API account of the account as well. Currently, the ID of the parameter cannot be read out in the interface. A change is currently prepared by the development.
How can the API account ID be queried?
Database view
Open "Database View" module via Supersearch or via the Appstore. Table "api_accounts" select. In the column "Designation" search for the name/designation of the API account.
Note: If there are multiple entries, the view may be not only slowly or not opened. Here then switch to variant 2.
Report
Go to Controlling → Reports.
1. Create a new report
2. Specify the following SQL
select id, designation from api_account where designation like '%Migration%' // The name here depends on the label used, of course. Columns generate
3. Under "View" display the corresponding ID
New example based on the parameter:
IhreURL/20.3/www/index.php?module=api&action=BenutzerListhash=b7a41dfcc80257710d799a7576f685f12f096624&api_id=26
The order of the parameters does not matter.
Alternative to hash call
After the hash call can also be used only for the API functions of the standard API there is also the option to go via the wrapper of the REST API.
The redirection is described here: https://update.xentral.biz/apidoc/docs203.html#standard_api_aufrufe
In addition, however, this also changes the method of authentication. https://update.xentral.biz/apidoc/docs203.html#authentifizierung