So our WMS-deliverer has now made a REST API. After testing it I must say that it's a bit easier to handle. Compared to working with SOAP. At least from the client-side. The developer site for this is here: https://developer.ongoingwarehouse.com/REST/v1/index.html#/

They have a link and some info regarding the Swagger Code-Generator. I was just curious to see how I could use the REST API in a most simple way. And I ended up using CURL, sending GET, POST, and PUT requests over HTTP. When using JSON to organize your data it is quite easy to get what you want. As in the other articles I will here do an example of getting order-information. Prerequisites:

 - getting information from goods-owners order-number
 - basic url is set to 'https://api.ongoingsystems.se/warehouse-name/api/v1/orders?' (everything after this is "json-encoded-data")
 - using HTTP GET, with PHP and curl

There's alot of examples from the net allready but here's my example:

//json-data
$jsonstring = '{
  "goodsOwnerId":  "67",
  "orderNumber": "201904231656-test"
}';
//our init-URL
$url="https://api.ongoingsystems.se/warehouse-name/api/v1/orders?";
//decode json-string, and build a the query-string. Reason fir this is that GET does not accept POST-data, so I'm just using the json for the sake of it.
//when creating an order I'll be using json-data anyway.
$url = $url.http_build_query(json_decode($jsonstring));
$data = json_decode($jsonstring);
//create the authorization header. This is according to the websites own credentials
$authorization_str = "Authorization: Basic ";
$login = 'login-name'.':'.'password';
$auth_header = "$authorization_str".base64_encode($login);

//init cURL
$curl = curl_init();
//set up some options
curl_setopt($curl, CURLOPT_HTTPGET, 1);
//this is important...a must in this case
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
              			$header_auth,
              			
           	));
$result = curl_exec($curl);
curl_close($curl);
//print it all out
var_dump($result);

The output of this is a json-string containing the data. It's up to "you" how you want to handle it. I prefer decoding it by using json_decode(...). The output after this is:

array(1) {
  [0]=>
  object(stdClass)#3 (7) {
    ["goodsOwner"]=>
    object(stdClass)#2 (2) {
      ["id"]=>
      int(67)
      ["name"]=>
      string(11) "profag test"
    }
    ["orderInfo"]=>
    object(stdClass)#4 (25) {
      ["orderId"]=>
      int(21820)
  
---etc----

Accessing the data is then object-oriented:

$tmp = json_decode($resource);
$T = $tmp[0];

echo "\nGoodsowner-Name is: ".$T->goodsOwner->name;
echo "\nOrderInfo->orderID is: ".$T->orderInfo->orderId;
echo "\n\n";

And the output of this is:

oslp@vxdwbsrvr:~/test/php/rest_og> php getorder.php

Goodsowner-Name is: profag test
OrderInfo->orderID is: 21820