Created
September 24, 2023 21:15
-
-
Save ImDevinC/96bd253bb7f39bee79dded5edc627e16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "log" | |
| "net/http" | |
| "os" | |
| _ "github.com/joho/godotenv/autoload" | |
| ) | |
| const pd3Url string = "https://nebula.starbreeze.com/challenge/v1/public/namespaces/pd3/users/me/records" | |
| var token = os.Getenv("NEBULA_BEARER_TOKEN") | |
| func main() { | |
| if token == "" { | |
| log.Fatal("Missing NEBULA_BEARER_TOKEN") | |
| } | |
| req, err := http.NewRequest(http.MethodGet, pd3Url, nil) | |
| if err != nil { | |
| log.Fatal(err) | |
| } | |
| req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token)) | |
| res, err := http.DefaultClient.Do(req) | |
| if err != nil { | |
| log.Fatal(err) | |
| } | |
| body, err := io.ReadAll(res.Body) | |
| if err != nil { | |
| log.Fatal(err) | |
| } | |
| log.Println(string(body)) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment