Go Server API SDK
The Fingerprint Server Go SDK is an easy way to interact with our Server API from your Go application. You can retrieve visitor history or individual identification events.
How to install
Get the package from GitHub using go get
.
go get github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v6/sdk
Initialize the client instance and use it to make API requests. You need to specify your secret API key and region (if it is not US/Global).
package main
import (
"context"
"fmt"
"github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v6/sdk"
"log"
)
func main() {
cfg := sdk.NewConfiguration()
client := sdk.NewAPIClient(cfg)
auth := context.WithValue(
context.Background(),
sdk.ContextAPIKey,
sdk.APIKey{Key: "<SECRET_API_KEY>"},
)
// cfg.ChangeRegion(sdk.RegionEU)
// Get visit history of a specific visitor
getVisitsOpts := sdk.FingerprintApiGetVisitsOpts{
Limit: 10,
}
visits, visitsHttpRes, visitsErr :=
client.FingerprintApi.GetVisits(auth, "<visitorId", &getVisitsOpts)
if visitsErr != nil {
log.Fatal(visitsErr)
}
fmt.Printf("Visitor history: %s", visits, visitsHttpRes)
// Get a specific identification event
event, eventHttpRes, eventErr :=
client.FingerprintApi.GetEvent(auth, "<requestId>")
if eventErr != nil {
log.Fatal(eventErr)
}
fmt.Printf("Event: %s", event, eventHttpRes)
}
Documentation
You can find the full documentation in the official GitHub repository. The repository also contains an example app demonstrating the usage of the library.
Updated about 1 month ago