(Delphi ActiveX) Shopify Delete Product
Delete a product from the shop.
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;
...
procedure TForm1.Button1Click(Sender: TObject);
var
rest: TChilkatRest;
success: Integer;
sbResponse: TChilkatStringBuilder;
begin
rest := TChilkatRest.Create(Self);
rest.SetAuthBasic('SHOPIFY_PRIVATE_API_KEY','SHOPIFY_PRIVATE_API_SECRET_KEY');
success := rest.Connect('chilkat.myshopify.com',443,1,1);
if (success <> 1) then
begin
Memo1.Lines.Add(rest.LastErrorText);
Exit;
end;
sbResponse := TChilkatStringBuilder.Create(Self);
success := rest.FullRequestNoBodySb('DELETE','/admin/products/#{id}.json',sbResponse.ControlInterface);
if (success <> 1) then
begin
Memo1.Lines.Add(rest.LastErrorText);
Exit;
end;
if (rest.ResponseStatusCode <> 200) then
begin
Memo1.Lines.Add('Received error response code: ' + IntToStr(rest.ResponseStatusCode));
Memo1.Lines.Add('Response body:');
Memo1.Lines.Add(sbResponse.GetAsString());
Exit;
end;
Memo1.Lines.Add('Example Completed.');
end;
|