The Lytics SDK for go offers easy integration with our public REST API endpoints. This library is actively being managed and every effort will be made to ensure that all handling reflects the best methods available. Overview of supported methods outlined below.
https://learn.lytics.com/api-docs
The Lytics CLI utilizes this library.
- Import the library.
go get github.com/lytics/go-lytics
- Create a new client from api key.
- Run one of the many methods to access account info.
package main
import (
"fmt"
"encoding/json"
lytics "github.com/lytics/go-lytics"
)
func main() {
// set your api key
key := "<YOUR API KEY>"
// create the client
client := lytics.NewLytics(key, nil)
// create a scanner for All Users in a Segment
scan := client.PageSegment(`
FILTER AND (
lastvisit_ts > "now-2d"
EXISTS email
)
FROM user
`)
// handle processing the users
for {
e := scan.Next()
if e == nil {
break
}
by, err := json.Marshal(e.Fields)
if err != nil {
fmt.Println("ERROR: ", err)
continue
}
fmt.Println(string(by))
}
}
- Account
- Single
GET
- All
GET
- Single
- Admin User
- Single
GET
- All
GET
- Single
- Segment
- Single
GET
- All
GET
- Single
- Entity (end users) API
GET
- Catalog
- Schema
GET
- Schema
- Query
- All
GET
- Test Evaluation
POST
- All
Want to add something? Go for it, just fork the repo and
send us a PR. Please make sure all tests run go test -v
and that all new functionality comes with well documented and thorough testing.
MIT Copyright (c) 2018, 2017, 2016, 2015 Lytics