Finish Editing an Online Document in Go

Cloudmersive
1 min readAug 11, 2021

Once you have performed all the editing operations you need on an online document, you are ready to close out processing and download the updated file. This can be accomplished by taking the secure URL you received from the Begin Editing function and calling the Finish Editing function.

The URL can be input into the following example code, along with your API key, to call the function:

package mainimport (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {url := "https://api.cloudmersive.com/convert/edit/finish-editing"
method := "POST"
payload := strings.NewReader("InputFileUrl=%3Cstring%3E")client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
req.Header.Add("Apikey", "YOUR-API-KEY-HERE")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}

In no time at all, your changes will be solidified in your new document, and the URL will expire. If you need to perform additional operations on the file in the future, you will need to perform the Begin Editing function again.

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.