This library provides convenient access to the eWarehousing Solutions API from applications written in the Go language.
https://api.docs.ewarehousing-solutions.com/
go get -u github.com/ewarehousing-solutions/ewhs-api-go
- Go 19+
config := ewhs.NewConfig("username", "password", "wms_code", "customer_code", false)
client, err := ewhs.NewClient(nil, config)
if err != nil {
log.Fatal(err)
}
If you want to use the testing API, set the testing
parameter to true
config := ewhs.NewConfig("username", "password", "wms_code", "customer_code", true)
Collection routes allow query parameters to filter the dataset. Query params can be added using the corresponding ListOptions{}
type. For example, if you want to search for a specific order reference:
options := &ewhs.OrderListOptions{
Reference: "SEARCH_REFERENCE",
}
orders, res, err := client.Orders.List(context.Background(), options)
The package provides a helper which can be used to easily verify the webhooks
func ValidateWebhook(httpRequest *http.Request) bool {
secret := "super-secret-password"
return VerifyWebhookRequest(httpRequest, secret)
}
Many objects allow you to request additional information as an expanded response by using the expand header. This parameter is available on all API requests, and applies to the response of that request only. Checkout the documentation for all possible options.
ctx := context.Background()
order, res, err := client.Orders.Get(context.WithValue(ctx, "Expand", "order_lines")) // Comma seperated value -> order_lines,shipping_method,etc
www.ewarehousing-solutions.nl — [email protected]
This package is heavily based on https://github.com/VictorAvelar/mollie-api-go.