1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
function TDataPrestashop.updatecombinaison(boutique: string;
id, idprod, mqte: Integer; ean, ref, sku: String): Integer;
var
axml: String;
const
fxml = '<?xml version="1.0" encoding="UTF-8"?> ' +
'<prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> ' +
'<combination> ' + ' <id>%d</id> ' + ' <id_product>%d</id_product> ' +
' <reference>%s</reference>' + ' <ean13>%s</ean13> ' +
' <supplier_reference>%s</supplier_reference> ' +
' <minimal_quantity>%d</minimal_quantity> ' + ' </combination> ' +
'</prestashop>';
begin
RESTClientUpdate.BaseURL := Format('https://%s/api/combinations/%d',
[boutique, id]);
axml := Format(fxml, [id, idprod, ref, ean, sku, mqte]);
RESTUpdate.Params.ParameterByName('body').Value := axml;
try
RESTUpdate.Execute;
{ TODO -oOwner -cGeneral : Test résultat = 200 }
result := RESTResponseUpdate.StatusCode;
// if result <> 200 then
// showmessage(RESTResponseUpdate.Content);
except
result:=400;
end;
end; |