Skip to main content
Matrix42 Self-Service Help Center

Object Data Service: Create Object

Details

Creates a new Object of the specified Configuration Item. 

Request

URL

POST https://{server_name}/m42Services/api/data/objects/{ciName}

URL attributes 

Element Description Type Required
ciName Technical name of the Configuration Item (e.g. for Incident is "SPSActivityTypeIncident") string Required

Headers

For a list of available HTTP request headers see Web Services: REST API integration.

POST body

The JSON object of the following format. 

{
   "DataDefinition1":{
      "Attribute1":"cf060d4d-5c47-462f-b5d1-7df6c865fd91",
      "Attribute2":null
   },
   "DataDefinition2":{      
      "Attribute3":"TCK00002",
      "Attribute4":"9999-12-31T23:59:59.997Z"
   },
   "MultiFragmentDataDefinition1":[
      {       
         "Attribute4":"Name 1"
      },
      {       
         "Attribute4":"Name 2"
      },      
   ]
}

If needed it is possible explicitly set IDs for the created Object or related fragments. If IDs are omitted in the Request, they are auto-generated

Response

Guid. ID of the Created Object

Status codes and errors

Code Message
401 Unauthorized
415 The request Content-type is not defined
500 Internal Server Error. E.g. wrong reference, or mandatory attribute is missing 

 

 

Examples

Example 1:  Create the Incident 

The following request creates the Incident 

POST https://{server_name}/m42Services/api/data/objects/SPSActivityTypeIncident/ HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer {token}

{     
   "SPSActivityClassBase": {
     "Subject":"Incident created over Public API 2",
      "Category":"42b49002-fed3-4c9b-9532-cf351df038cf",
      "Initiator":"<User Fragment Id>",     
      "Urgency":3,
      "Impact":3,
      "DescriptionHTML":"Description of the Incident"
   },   
   "SPSActivityClassUnitOfWork":[
      {
         "TypeID":"fe098714-ac94-47f1-9724-df5bac86b3fb",
         "OriginalSolutionHtml":"Created by Public API",                 
         "ActivityAction": 0,
         "CreatedDate":"2019-03-20T16:44:33.67Z"        
      }
   ]
}

Example 2: Create a Ticket with the immediate transformation to Incident 

If the organization uses the Ticket Management, all the incoming issues have to be created first as Ticket object and then turned, depending on kind of the issues, either to Incident or Service Request. The Service allows executing these two operations, as is creating a ticket first and then transforming it to the appropriate type, in one single service request. For that, the request should provide additional directive "TicketType" ( "0" for Incident; "6" - Service request), which runs the transformation. 

POST https://{server_name}/m42Services/api/data/objects/SPSActivityTypeTicket/ HTTP/1.1
Content-Type: application/json;charset=UTF-8
Authorization: Bearer {token}

{     
   "SPSActivityClassBase": {
     "Subject":"Incident created from a Ticket",
      "Category":"42b49002-fed3-4c9b-9532-cf351df038cf",  
      "Initiator":"<User Fragment Id>",   
      "Urgency":3,
      "Impact":3,
      "DescriptionHTML":"Description of the Incident created fro the Tikcet"
   },
   "InitialData":{
        "Configuration":{"TicketType":"0"}
   }
}
  • Was this article helpful?