Unsupported protocol scheme

I’ve the below url that is getting a JSON as responce:

Trying to get the same output through GO, so I wrote the below Go Playground - The Go Programming Language

package main

import (

func main() {
	req, _ := http.NewRequest("GET", "https://script.google.com/macros/s/AKfycbzw0TKWycxeB5sx1wIefAiEHeYQt2mVuM-NAZTccxedhyntdv8FvcUteOZ2k03wRHGE/exec?", nil)

	q := req.URL.Query()
	q.Add("barcode", "6287029390129")
	//q.Add("another_thing", "foo & bar")
	req.URL.RawQuery = q.Encode()


	// url := "https://script.google.com/macros/s/AKfycbzw0TKWycxeB5sx1wIefAiEHeYQt2mVuM-NAZTccxedhyntdv8FvcUteOZ2k03wRHGE/exec?barcode=6287029390129"
	resp, err := http.Get(req.URL.RawQuery) //
	_ = req.URL.RawQuery
	if err != nil {

	//We Read the response body on the line below.
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
	//Convert the body to type string
	sb := string(body)

But I got the below error:

2009/11/10 23:00:00 Get "barcode=6287029390129": unsupported protocol scheme ""

Based on some comments recieved, I changed resp, err := http.Get(req.URL.RawQuery) to be: resp, err := http.Get(req.URL.String()), also I used it as: resp, err := http.DefaultClient.Do(req) Go Playground - The Go Programming Language

But I got the below error in both cases:

2009/11/10 23:00:00 Get "https://script.google.com/macros/s/AKfycbzw0TKWycxeB5sx1wIefAiEHeYQt2mVuM-NAZTccxedhyntdv8FvcUteOZ2k03wRHGE/exec?barcode=6287029390129": dial tcp: lookup script.google.com on dial udp connect: no route to host

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.