Skip to main content

Hi, I am trying to import orders from Shopware store to Xentral through API. I was able to insert an address experimentally with the Postman (So I don’t have problem with the API in Xentral).
I following this document . But I could not find the endpoint API  associated with the order.

How can I insert orders with the API? Generally has Xentral endpoint for this case?

Please answer faster if you know the answer. Give me a document or give me a clue on how I can do this.

Because my chief does not give me several days for an issue. I am very grateful for your attention.


Hi Morteza,

you can’t use the REST API for this action, there is no POST method for ORDERS.

 

Here ist the doc for SOAP API, but only available in german. 

https://help.xentral.com/hc/de/articles/360017436919-API-Dokumentation#toc-9

 

best

joschi

 


Hi, I used your document.Thank you for your quick response
I wrote a simple class to insert the address according to the document.

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;

class XentralController extends Controller

{

public function testSoapApiXentral()

{

$hash = $this->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 = $this->SendRequest("AdresseCreate",$xml,$hash);

$obj = simplexml_load_string($output_xml);

echo "<pre>";
print_r($obj);
echo "</pre>";

dd($output_xml);
}



function SendRequest($methodname,$xml,$hash)

{

// dd($hash);

$url = 'http://xentralmain.local/index.php?
module=api&action='.$methodname.'&hash='.$hash.'&api_id=1';

$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));

$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;

}

public function generateHash()

{

$initKey = '06e7134e2cb7e35f3181ad7d44894b76e74b782f';

$remoteDomain = 'http://xentralmain';

$date = gmdate('dmY');

$hash = "";

for($i = 0; $i <= 200; $i++)

$hash = sha1($hash . $initKey . $remoteDomain . $date);

return $hash;

}

}


In the generateHash method, I used the Aktueller Key: value for the $initKey variable

Now I have an error for the hash. How should I fix it?

 


Hi,

use $initKey = 'admin';

that is what you set in the config

this string '06e7134e2cb7e35f3181ad7d44894b76e74b782f' is the all ready hashed password for testing with command line tools curl etc. 

 

best 

joschi

 


Antworten