unrecognized object in json


(Joe Calcada) #1

Hi folks,

I have a simple curl command to create an incident. It works great but when I try to add the “body” portion to the json file as illustrated in https://v2.developer.pagerduty.com/docs/incident-creation-api

I get the following error: Any thoughts ? Appreciate the help.

{“status”:“unrecognized object”,“message”:“Object format is unrecognized”,“errors”:[“JSON parse error”]}virtuser@devops202:~/Desktop>

here is the content of the json file:
virtuser@devops202:~/Desktop> cat unsuccessful.json
“incident”: {
“type”: “incident”,
“title”: “JKE application deployment failed”,
“service”: {
“id”: “P6SZTCU”,
“type”: “service_reference”
“body”: {
“type”: “incident_body”,
“details”: “details here”

(geeth) #2

Hi Joe!

Looking at the code you provided, I noted two of the end curly-brackets were missing the comma with the service and the body.

  "incident": {
    "type": "incident",
    "title": "JKE application deployment failed",
    "service": {
      "id": "P6SZTCU",
      "type": "service_reference"
    }, // comma after service object here
    "body": {
      "type": "incident_body",
      "details": "details here"
    }, // comma after body parameter here

Updating this successfully triggers an incident.