Sample code for 30+ languages & platforms
Go

Lightspeed - Delete a Product

See more Lightspeed Examples

Remove an existing product based on the unique identifier

Chilkat Go Downloads

Go
    success := false

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    http := 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 := 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()