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

Trouble creating an integration #102

Closed
sevagh opened this issue Jan 3, 2018 · 3 comments
Closed

Trouble creating an integration #102

sevagh opened this issue Jan 3, 2018 · 3 comments

Comments

@sevagh
Copy link

sevagh commented Jan 3, 2018

Hello,

I'm trying to create an Events API V1 integration programatically.

My code looks like this:

integration := pagerduty.Integration{Type: "generic_events_api_inbound_integration_reference"}
integration.Type = "generic_events_api_inbound_integration_reference"
eventsAPIV1Integration, err := client.CreateIntegration(service.ID, integration)
if err != nil {
       return "", err
}

I get the following error: FATA[0007] Failed call API endpoint. HTTP response code: 400. Error: &{2001 Invalid Input Provided [Type cannot be empty.]}

If I create the integration by hand in the UI, this code succeeds:

for _, integration := range service.Integrations {
       if integration.Type == "generic_events_api_inbound_integration_reference" {
               eventsAPIV1Integration, err = client.GetIntegration(service.ID, integration.ID, pagerduty.GetIntegrationOptions{})
               if err != nil {
                     return "", err
              }
        }
}

I'm trying to use the same integration.Type: generic_events_api_inbound_integration_reference, but it doesn't seem to work.

@sevagh
Copy link
Author

sevagh commented Jan 3, 2018

The doc isn't really clear on what I need to create an integration: https://godoc.org/github.com/PagerDuty/go-pagerduty#Client.CreateIntegration

For example, id string would be more clear as serviceId string. Can I make a PR to change that?

@sevagh
Copy link
Author

sevagh commented Jan 3, 2018

Clearer output:

Attempting to create an integration: pagerduty.Integration{
    APIObject:        pagerduty.APIObject{ID:"", Type:"generic_events_api_inbound_integration_reference", Summary:"", Self:"", HTMLURL:""},
    Name:             "",
    Service:          (*pagerduty.APIObject)(nil),
    CreatedAt:        "",
    Vendor:           (*pagerduty.APIObject)(nil),
    Type:             "generic_events_api_inbound_integration_reference",
    IntegrationKey:   "",
    IntegrationEmail: "",
}FATA[0006] Failed call API endpoint. HTTP response code: 400. Error: &{2001 Invalid Input Provided [Type cannot be empty.]}

@sevagh
Copy link
Author

sevagh commented Jan 3, 2018

So apparently to create it, the key is generic_events_api_inbound_integration, and after its created, the key turns into generic_events_api_inbound_integration_reference. Is this expected?

@sevagh sevagh closed this as completed Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant