(Go) Lightspeed - Delete a Product
Remove an existing product based on the unique identifier For more information, see https://developers.lightspeedhq.com/ecom/endpoints/product/#delete-delete-a-product
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := chilkat.NewHttp()
var success bool
// 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 := http.QuickRequest("DELETE","https://api.webshopapp.com/en/products/PRODUCT_ID.json")
if http.LastMethodSuccess() == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
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.")
resp.DisposeHttpResponse()
http.DisposeHttp()
return
}
resp.DisposeHttpResponse()
fmt.Println("Success.")
http.DisposeHttp()
|