This is a go package for working with the CrossRef API. It is inspired by the an excellent CrossRefAPI Python package listed in the CrossRef API docs. This package is meant to follow the “polite” guidelines for interacting with the public API at api.crossref.org.
:= path.Base(os.Args[0])
appName , err := crossrefapi.NewCrossRefClient(appName, "jane.doe@library.example.edu")
clientif err != nil {
// handle error...
}
, err := client.Works("10.1037/0003-066x.59.1.29")
works
if err != nil {
// handle error...
}
// continue processing your "works" result...
You can compare two copies of a “works” response and see what has changed.
:= path.Base(os.Args[0])
appName , err := crossrefapi.NewCrossRefClient(appName, "jane.doe@library.example.edu")
clientif err != nil {
// handle error...
}
, err := client.Works("10.1037/0003-066x.59.1.29")
newWorksif err != nil {
// handle error...
}
// Fetch our previously saved works document.
, err := os.ReadFile("0003-066x.59.1.29.json")
srcif err != nil {
// handle error...
}
:= new(crossrefapi.Works)
oldWorks if err := json.Unmarshal(src, &oldWorks); err != nil {
// handle error...
}
, err = oldWorks.DiffAsJSON(newWorks)
srcif err != nil {
// handle error...
}
.Println("Diff for 10.1037/0003-066x.59.1.29")
fmt.Printf("\n%s\n", src) fmt
crossrefapi -mailto="jane.doe@library.example.edu" works "10.1037/0003-066x.59.1.29"