Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't disable subscription tracking #68

Closed
joaolsilva opened this issue Jul 1, 2016 · 1 comment
Closed

Can't disable subscription tracking #68

joaolsilva opened this issue Jul 1, 2016 · 1 comment
Labels
status: help wanted requesting help from the community type: bug bug in the library

Comments

@joaolsilva
Copy link

Issue Summary

The API won't allow disabling subscription tracking because the Enable parameter won't be sent when it's false, returning the error: "The subscription_tracking enable parameter is required."

Steps to Reproduce

Send an email with the following options:

trackingSettings := mail.NewTrackingSettings()
subscriptionTrackingSetting := mail.NewSubscriptionTrackingSetting()
subscriptionTrackingSetting.SetEnable(false)
trackingSettings.SetSubscriptionTracking(subscriptionTrackingSetting)
m.SetTrackingSettings(trackingSettings)

The following error will be returned:

&{400 {"errors":[{"message":"The subscription_tracking enable parameter is required.","field":"tracking_settings.subscription_tracking.enable","help":"http://sendgrid.com/docs/API_Reference/Web_API_v3/Mail/errors.html#message.tracking_settings.subscription_tracking.enable"}]} map[X-Frame-Options:[DENY] Server:[nginx] Date:[Fri, 01 Jul 2016 12:09:18 GMT] Content-Type:[application/json] Content-Length:[270] Connection:[keep-alive]]}

This happens because the Enabled field of the SubscriptionTrackingSetting struct has the JSON options json:"enable,omitempty" therefore false is not encoded. See http://stackoverflow.com/questions/37756236/json-golang-boolean-omitempty for more information.

@thinkingserious thinkingserious added type: bug bug in the library status: help wanted requesting help from the community labels Jul 1, 2016
@thinkingserious
Copy link
Contributor

This is now fixed in version 3.0.3: https://github.com/sendgrid/sendgrid-go/releases/tag/v3.0.3

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: bug bug in the library
Projects
None yet
Development

No branches or pull requests

2 participants