(PureBasic) Akeneo: Delete Product
Demonstrates how to delete product.
IncludeFile "CkHttp.pb"
Procedure ChilkatExample()
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; Use your previously obtained access token.
; See Get Akeneo Access Token
CkHttp::setCkAuthToken(http, "access_token")
success.i
CkHttp::ckSetUrlVar(http,"productCode","123")
respStr.s = CkHttp::ckQuickDeleteStr(http,"http://pim.my-akeneo-site.com/api/rest/v1/products/{$productCode}")
If CkHttp::ckLastMethodSuccess(http) <> 1
Debug CkHttp::ckLastHeader(http)
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
ProcedureReturn
EndIf
Debug "Response Status Code: " + Str(CkHttp::ckLastStatus(http))
Debug "Response Body: " + respStr
CkHttp::ckDispose(http)
ProcedureReturn
EndProcedure
|