Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

StatusPage API: create incident specifying new status

In the documentation, it is shown how to define an array. But if I am not mistaken, in order to define the new status of a new incident I would need to use a map and I don't figure out how to do this.

From the documentation, how to define an array (components):

// JSON
{
  "incident": {
    "name": "test incident",
    "components": ["8kbf7d35c070", "vtnh60py4yd7"]
  }
}

// Form Encoded (using curl as an example):
curl -X POST https://api.statuspage.io/v1/example \
  -d "incident[name]=test incident" \
  -d "incident[components][]=8kbf7d35c070" \
  -d "incident[components][]=vtnh60py4yd7"

 

To create an incident and set the new status, I should define these (among others; name, etc):

  • components: Map of status changes to apply to affected components
    • component_id: Map of status changes to apply to affected components  ("operational" "under_maintenance" "degraded_performance" "partial_outage" "major_outage" "")
  • component_ids: Array of strings. List of component_ids affected by this incident

 

Belo, my unsuccessful tries below:

-d "incident[component_ids][]=yxrqcr0kc3hx"  \
-d "incident[components][component_id][]={'yxrqcr0kc3hx' : 'major_outage'}"
-d "incident[component_ids][]=yxrqcr0kc3hx" \
-d "incident[components][component_id][yxrqcr0kc3hx]=major_outage"
-d "incident[component_ids][]=yxrqcr0kc3hx" \
-d "incident[components][component_id]['yxrqcr0kc3hx']=major_outage"

 

Please, any help will be welcome.

Thanks

2 answers

1 accepted

0 votes
Answer accepted

I have just figured it out:

-d "incident[component_ids][]=yxrqcr0kc3hx" \
-d "incident[components][yxrqcr0kc3hx]=major_outage"

Now, it makes totally sense.

OK, I get it. You specify the ID of the component, then you specify what value you want that that component to be, based on its ID.

The REST API documentation on the vendor's website isn't exactly helpful or illustrative; it just provides a lump of JSON without much explanation. Providing a cURL example that's just a tiny snippet of what's shown in the JSON example doesn't help either.

From what I can understand on the StatusRest API documentation page, in the Create an Incident section, it looks like when you create an Incident, you can create a Component on the Incident Page and give that Component an ID in the form of some name as a string.

You don't seem to be able to set the value of that Component when the page is being created, rather you have to update the value of the new Component after the page has been created by doing a Component PATCH request and referring to it by its ID and the Page ID using the endpoint:

/pages/{page_id}/components/{component_id}

So, I'd say you create the Incident page with the Component on it, parse the ID of that page and the ID of the Component from the response, then submit a new request to update the Component's value on that page by submitting a new request.

No, the components already exist. And users want to create an incident because something is wrong in those existing components. As part of this reporting process or incident creation, users need to define the new status on the affected components. Otherwise, they stay with their default value: Operational. Hence, the effect is as no incident was created.

The explanations I posted of "components" and "component_ids" are not my words, it also comes from the StatusPage API documentation - create incident 

In my opinion, your proposal is a workaround but not the proper way to do it. With your proposal, all our customers would receive two notifications: one with the creation of the incident and another adjusting the status of the component in the new incident. There must be a way to add the map data in the curl command.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Statuspage

New feature: Slack notifications for Statuspage

We're excited to announce the release of a long-requested feature on Statuspage. Now visitors to your status page can subscribe to get notified in Slack when you report an incident or maintenance. Th...

900 views 0 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you