How to Generate a QR Code in Go

package mainimport (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {url := "https://api.cloudmersive.com/barcode/generate/qrcode"
method := "POST"
payload := strings.NewReader("0=%3C&1=s&2=t&3=r&4=i&5=n&6=g&7=%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))
}

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

So if we do not give them fluids we are setting them up for kidney failure.

Week 5 — Windows and Staying Current

Build and configure AKS on Azure using Terraform

Why we built SlicingDice?

10 things I wish I knew before learning Terraform

How to build a successful car rental app like Turo?

How to Identify Age from an Image in Go

MERGE SORT

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

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

More from Medium

Quick Set up Cloudreve in minutes using Tin

How to build AdonisJS API to store your Raspberry Pi Temperature

How to run PostgreSQL in Docker on Mac (for local development)

Advantages of Using Docker for Microservices