Loading...
Perhaps one of the most important packages for integrating with Apito's REST API tools is the net/http package.
This package allows you to build HTTP servers in Go and make requests to our database API with its powerful compositional constructs.
You can use it to make HTTP calls to your instant API builder endpoints. Follow the example below to integrate with Apito's REST API tools.
net/http libraryTip:
Always remember to replace
API_SECRETin the Bearer Token andproject-idin the URL with the correct values from the Apito console.
If you are unsure where to find your API secrets and endpoints for your project, visit this page.
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.apito.io/secured/rest/project-id"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("content-type", "application/json")
req.Header.Add("authorization", "Bearer API_SECRET")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}