Skip to content

Commit eee0859

Browse files
Tom Wentworthclaude
authored andcommitted
Fix severities endpoint to use V1 API
The severities endpoints (list and get) are part of incident.io's V1 API, not V2. This fix temporarily switches the base URL to V1 when making severities requests. Changes: - Update ListSeverities() to use V1 API endpoint - Update GetSeverity() to use V1 API endpoint - Add comments explaining the API version difference This resolves the 404 errors when calling list_severities tool. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 356ac70 commit eee0859

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

internal/incidentio/severities.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ type ListSeveritiesResponse struct {
1414

1515
// ListSeverities returns all severities
1616
func (c *Client) ListSeverities() (*ListSeveritiesResponse, error) {
17+
// Note: Severities are under V1 API, not V2
18+
// We need to temporarily change the base URL for this request
19+
originalBaseURL := c.BaseURL()
20+
c.SetBaseURL("https://api.incident.io/v1")
21+
defer func() { c.SetBaseURL(originalBaseURL) }()
22+
1723
respBody, err := c.doRequest("GET", "/severities", nil, nil)
1824
if err != nil {
1925
return nil, err
@@ -29,6 +35,12 @@ func (c *Client) ListSeverities() (*ListSeveritiesResponse, error) {
2935

3036
// GetSeverity retrieves a specific severity by ID
3137
func (c *Client) GetSeverity(id string) (*Severity, error) {
38+
// Note: Severities are under V1 API, not V2
39+
// We need to temporarily change the base URL for this request
40+
originalBaseURL := c.BaseURL()
41+
c.SetBaseURL("https://api.incident.io/v1")
42+
defer func() { c.SetBaseURL(originalBaseURL) }()
43+
3244
respBody, err := c.doRequest("GET", fmt.Sprintf("/severities/%s", id), nil, nil)
3345
if err != nil {
3446
return nil, err

0 commit comments

Comments
 (0)