We have 5 ways for deleting data in API :

A. Delete By Single Code

This function is used to delete a single object by giving its code.

a. Using HTTP

URL : { REST API Host } / app / { Winbooks OM } / { Code } / Folder/ { FolderCode } 
Method : DELETE
Header :
    Authorization : Bearer {access_token}

If the object is deleted successfully, a response with success status 200 code will be returned

The example below will delete  a customer with code " VLADIMIR " in folder " PARFIWEB_DEMO "

URL https://rapi.winbooksonweb.be/app/Customer/VLADIMIR/Folder/PARFIWEB_DEMO

Method :  DELETE

Header 

                Authorization : Bearer gAAAAEg9vKjrggECqOrp6bekZ0KO6_86-URgC5D1xYxXqexQyaOu_St ....

b. Using Winbooks.Apis.Services 


Delete Customer By Code

//SERVICES WITH RESTAPIDEMO FOLDER
EntitiesServices folderRESTAPIDEMO = new EntitiesServices(userCredential, "PARFIWEB_DEMO" );
//DELETE CUSTOMER
folderRESTAPIDEMO.DeleteByCode<Customer>( "VLADIMIR" );

B. Delete By ID

a. Using HTTP

The same as Delete By Single Code, just replay Code by ID

b. Using Winbooks.Apis.Services 

 
Delete by Id


//DELETE A CUSTOMER BY ID
folderPARFIWEB.DeleteById<Customer>( "79A2E56E-2BE7-4216-BA75-9F9400FB45BD" );

C. Delete By List of Codes

This function is used to delete a list of objects by giving a list of codes.

a. Using HTTP

URL : { REST API Host } / app / { Winbooks OMS } / Folder / { FolderCode } ? code = {list of code seperate by ',' }
Method : DELETE
Header :
    Authorization : Bearer {access_token}
    Accept : application/json { this will return the result in json format}

If the object is deleted successfully, a response with success status 200 code will be returned and contains the list of objects deleted successfully and failed

The example below will delete a list of customer with code "VLADIMIR,TITAN,JIMMY,JORDAN,SPARKLES" in folder "PARFIWEB_DEMO"

URL   https://rapi.winbooksonweb.be/app/Customers/Folder/PARFIWEB_DEMO?code=VLADIMIR,TITAN,JIMMY,JORDAN,SPARKLES

Method :  DELETE

Header : 

               Authorization : Bearer gAAAAEg9vKjrggECqOrp6bekZ0KO6_86-URgC5D1xYxXqexQyaOu_St ....

b. Using Winbooks.Apis.Services 

object[] arrayCustomerCode = new string[] { "ADAM" "MIRANDA" "Jordin" "SPARKS" };
  ICriteria filterDelete = new CustomerDAO().CreateCriteria();
  filterDelete.Add(Condition.In(Customer.Names.Code, arrayCustomerCode));
  folderPARFIWEB.DeleteFilter<Customer>(filterDelete);

D. Delete By Criteria

This function is used to delete a list of objects by giving a condition. 

a. Using HTTP

URL :{ REST API Host } / app / { Winbooks OMS } / Folder / { FolderCode }/DeleteByCriteria
Method : POST
Header :
    Authorization : Bearer {access_token}
Content : application/json
Accept : application/json
Body content : {Criteria in json format}

** for getting criteria in json format, please take a look at function "Get By Criteria"

The example below will delete all Customers whose country code is "GB "

URL : https://rapi.winbooksonweb.be/app/Customers/Folder/PARFIWEB_DEMO/DeleteByCriteria

Method  : POST

Header :

        Authorization Bearer gAAAAEg9vKjrggECqOrp6bekZ0KO6_86-URgC5D1xYxXqexQyaOu_St ....

        Content application/json

        Accept application/json

 Body content : {"Alias":"this","Association":{"t":{"OwnerAlias":null,"AliasName":"t","Type":"Winbooks.TORM.OM.Third, Winbooks.TORM.OM, Version=1.66.3.0, Culture=neutral, PublicKeyToken=null","JoinType":1,"Properties":    ["Id","Third_Id"],"Condition":null},"c":{"OwnerAlias":null,"AliasName":"c","Type":"Winbooks.TORM.OM.Country, Winbooks.TORM.OM, Version=1.66.3.0, Culture=neutral, PublicKeyToken=null","JoinType":1,"Properties":    ["Id","t.VatCountry_Id"],"Condition":null}},"Conditions":[{"Operator":0,"PropertyName":"c.Code","OtherPropertyName":"","Values":["GB"]}],"ProjectionsList":[],"Orders":{},"Params":{},"FirstResult":-1,"MaxResult":-1}

b. Using Winbooks.Apis.Services


Delete By Criteria

// DELETE BY CRITERIA           
ICriteria criteria = new CustomerDAO().CreateCriteria();
criteria.Add(Condition.Eq(Customer.Names.IsLocked, false ));
criteria.Add(Condition.Eq(Customer.Names.IsHidden, false ));
EntitiesServices folderRESTAPIDEMO = new EntitiesServices(userCredential, "PARIWEBDEMO" );
folderPARFIWEB.DeleteFilter<Customer>(criteria);

E. Delete All Data Objects 

This function is used to clear all data objects.

a. Using HTTP

URL : { REST API Host } / app / { Winbooks OMS } / Folder / { FolderCode }
Method : DELETE
Header : 
    Authorization : Bearer { access_token}
    Accept : application/json

b. Using Winbooks.Apis.Service  


Delete All Customer

EntitiesServices folderRESTAPIDEMO = new EntitiesServices(userCredential, "PARIWEB_DEMO" );
folderRESTAPIDEMO.DeleteAll<Customer>();


Top