Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Convert newAlertContact ID from int to string.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Bloemberg committed Apr 23, 2019
1 parent c8ec0c4 commit 613e608
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion uptimerobot/api/alert_contact.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net/url"
"strconv"
)

// maximum pagination depth to allow (10*50=500 entries)
Expand Down Expand Up @@ -144,7 +145,13 @@ func (client UptimeRobotApiClient) CreateAlertContact(req AlertContactCreateRequ
return
}

return client.GetAlertContact(alertcontact["id"].(string))
// The alert contact ID is a string value according to API docs but is
// returned as a integer value by the newAlertContact API JSON. In other
// places the API does correctly handle it as a string value.
// The difference made by it being a string is that a zero prefix to the ID // number is preserved. A zero prefixed alert contact ID is thus far only
// been observed on the default alert contact (created at account creation).
// https://github.com/louy/terraform-provider-uptimerobot/pull/21
return client.GetAlertContact(strconv.Itoa(alertcontact["id"].(int)))
}

func (client UptimeRobotApiClient) DeleteAlertContact(id string) (err error) {
Expand Down

0 comments on commit 613e608

Please sign in to comment.