(PureBasic) Shopify Delete Product
Delete a product from the shop.
IncludeFile "CkRest.pb"
IncludeFile "CkStringBuilder.pb"
Procedure ChilkatExample()
rest.i = CkRest::ckCreate()
If rest.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
CkRest::ckSetAuthBasic(rest,"SHOPIFY_PRIVATE_API_KEY","SHOPIFY_PRIVATE_API_SECRET_KEY")
success = CkRest::ckConnect(rest,"chilkat.myshopify.com",443,1,1)
If success <> 1
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
ProcedureReturn
EndIf
sbResponse.i = CkStringBuilder::ckCreate()
If sbResponse.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkRest::ckFullRequestNoBodySb(rest,"DELETE","/admin/products/#{id}.json",sbResponse)
If success <> 1
Debug CkRest::ckLastErrorText(rest)
CkRest::ckDispose(rest)
CkStringBuilder::ckDispose(sbResponse)
ProcedureReturn
EndIf
If CkRest::ckResponseStatusCode(rest) <> 200
Debug "Received error response code: " + Str(CkRest::ckResponseStatusCode(rest))
Debug "Response body:"
Debug CkStringBuilder::ckGetAsString(sbResponse)
CkRest::ckDispose(rest)
CkStringBuilder::ckDispose(sbResponse)
ProcedureReturn
EndIf
Debug "Example Completed."
CkRest::ckDispose(rest)
CkStringBuilder::ckDispose(sbResponse)
ProcedureReturn
EndProcedure
|