Go is a statically typed, compiled programming language. This tutorial is how to check a file for malware using Go.
REPLACE_ME
with your API key.location
value in payload with url location of your file.callback
value in payload to your webhook url. We recommend using webhook.site as a callback url during test.For 2 and 3, you can find this documented at Offical Documentation
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.filescanapi.com/v1/file/async"
method := "POST"
payload := strings.NewReader(`{
"location": "https://filescanapi.com/icon.png",
"metadata": {
"filename": "demo.png"
},
"callback": "https://webhook.site"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("x-api-key", "REPLACE_ME")
req.Header.Add("Content-Type", "application/json")
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))
}