How to add new or custom field in body with v2 create incident API

rest-api

#1

When creating an incident with the v2 create incident API, I would like to add new field in the body.

Using the example in the API reference
This works
{
“incident”: {
“type”: “incident”,
“title”: “Attack detected by K2”,
“service”: {
“id”: “PFHM59B”,
“type”: “service_reference”
},
“priority”: {
“id”: “P53ZZH5”,
“type”: “priority_reference”
},
“urgency”: “high”,
“incident_key”: “b3”,
“body”: {
“type”: “incident_body”,
“details”: “An attack detected”,
}
}
}

But as in the json below, if I add a new field “errorId” , the field is ignored.

{
“incident”: {
“type”: “incident”,
“title”: “Attack detected by K2”,
“service”: {
“id”: “PFHM59B”,
“type”: “service_reference”
},
“priority”: {
“id”: “P53ZZH5”,
“type”: “priority_reference”
},
“urgency”: “high”,
“incident_key”: “b3”,
“body”: {
“type”: “incident_body”,
“details”: “An attack detected”,
“errorId”:“123”
}
}
}

What is the best practice for adding custom fields to an incident ?


(Jimmy Perry) #2

Hey Manoj,

I was thinking this is the v2 REST API. Can you confirm if you’re using the REST API or the Events Api?


#3

Hi Jimmy

I am using the v2 REST API

regards


(Chiedu Uraih) #4

Hello Manoj,

If you want to create custom fields in the body of an Incident,
this can be achieved using the Events API V2.
I have referenced our guide here.

Thanks