Api rest conversion

Hi @Teodor
I have this json request (REST).
I can’t run it with Server API ACTION!
Can you tell me how to do it?
Thanks

 $data = '
    {
    "codCliente":"000000998226",
    "datiSpedizione":[{"idLdv": "' . $_GET['ldv'] .'","ultimoStato": "N"}],
    "descrizioneStatus": "E",
    "postazione": "4787F",
   "tipologiaCliente": "SDA"
    }
    ';
    $url = "https://wsrest.sda.it/TRACKING-WS-WEB/rest/TrackingRSService";
    try{
        $curl = curl_init($url);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array(
                'Content-Type: application/json',
                'Content-Length: ' . strlen($data))
                );                
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
        curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);    
        curl_setopt($curl, CURLOPT_USERPWD, "DEC344327:Webservice27!"); //base 64 REVDMzQ0MzI3OldlYnNlcnZpY2UyNyE=
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        $result = curl_exec($curl);
        if (($result = curl_exec($curl)) === FALSE) {
            die('cURL error: '.curl_error($curl)."<br />\n");
        }            
        curl_close($curl);  
        $tracking=json_decode($result, true);
//echo $tracking['outcome']."\r\n";
        echo "LDV numero: " . $tracking['spedizione']['0']['idLdv']."<br>";
        echo "Data: " . $tracking['spedizione']['0']['tracking']['0']['data'] . "<br>";
        echo "Stato della LDV: " . $tracking['spedizione']['0']['tracking']['0']['descrizioneStato']. "<br>";
        echo "Firmato da: " . $tracking['spedizione']['0']['tracking']['0']['firma'];
        //var_dump(json_decode($result, true));
    } catch(Exception $e) {
        print_r($e);
    }

What is the result/output of this file you want to use with the API connector?

image

You need a json result that can be called via the API Connector.