(Go) Lightspeed - Delete a Product
Remove an existing product based on the unique identifier Note: This example requires Chilkat v11.0.0 or greater. For more information, see https://developers.lightspeedhq.com/ecom/endpoints/product/#delete-delete-a-product
success := false
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := Http_Ref.html">chilkat.NewHttp()
// Implements the following CURL command:
// curl -X DELETE https://api.webshopapp.com/en/products/PRODUCT_ID.json \
// -u API_KEY:API_SECRET
// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code
http.SetLogin("API_KEY")
http.SetPassword("API_SECRET")
// Use the correct cluster for your shop. Here are the choices:
// eu1 https://api.webshopapp.com/en/
// us1 https://api.shoplightspeed.com/en/
resp := HttpResponse_Ref.html">chilkat.NewHttpResponse()
success = http.HttpNoBody("DELETE","https://api.webshopapp.com/en/products/PRODUCT_ID.json",resp)
if success == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
resp.DisposeHttpResponse()
return
}
respStatusCode := resp.StatusCode()
fmt.Println("Response Status Code = ", respStatusCode)
if respStatusCode != 204 {
fmt.Println("Response Header:")
fmt.Println(resp.Header())
fmt.Println("Response Body:")
fmt.Println(resp.BodyStr())
fmt.Println("Failed.")
http.DisposeHttp()
resp.DisposeHttpResponse()
return
}
fmt.Println("Success.")
http.DisposeHttp()
resp.DisposeHttpResponse()
|