That works! Thanks. I think we can call this one resolved.
Original Message:
Sent: Fri April 07, 2023 08:12 AM
From: Steven Shull
Subject: Is it possible to create a communication log entry via rest api?
Yep, I am seeing the same thing you are. Sorry in my test I didn't try to do it multiple times to the same SR. Add "_action":"Add" to the commlog record. That is working for me in quick tests as it will tell the framework up front we want to add this record.
The body should look like:
{
"ticketid":"1001",
"class":"SR",
"commlog":[
{
"sendfrom":"myemail@company.com",
"createby":"MAXADMIN",
"subject":"This is your email subject",
"message":"This is your email body",
"inbound":true,
"_action":"Add"
}
]
}
------------------------------
Steven Shull
Original Message:
Sent: Fri April 07, 2023 08:06 AM
From: Christopher Stewart
Subject: Is it possible to create a communication log entry via rest api?
It looks like the issue with the ID happens when there is another commlog already created. If there are no commlogs the first one creates and generates an ID. If there is at least one I get the error asking me to provide an ID.
------------------------------
Christopher Stewart
Original Message:
Sent: Thu April 06, 2023 10:05 AM
From: Steven Shull
Subject: Is it possible to create a communication log entry via rest api?
COMMLOGID is typically setup to autonumber. Can you open COMMLOG in database configuration and go to the COMMLOGID attribute. It should look like my screenshot below.

------------------------------
Steven Shull
Original Message:
Sent: Fri March 31, 2023 10:41 AM
From: Christopher Stewart
Subject: Is it possible to create a communication log entry via rest api?
Thanks for the info! This is super helpful. I have everything setup but I am getting the following error on post. I am on MAS 8.9 BTW:
BMXAA1339E - Missing key value for key COMMLOGID. Key value cannot be empty. Specify a value for the key and retry the operation.
Any ideas? I thought it would create a new key?
------------------------------
Christopher Stewart
Original Message:
Sent: Fri March 31, 2023 08:57 AM
From: Steven Shull
Subject: Is it possible to create a communication log entry via rest api?
First step is we need to create a new object structure in Maximo. MXAPISR is an out of the box object structure that doesn't have COMMLOG as part of it so we can't send the data we need for it to process.
In the Object Structures application of Maximo:
1) Duplicate MXAPISR. We want to duplicate out of box object structures when possible. I used the name EMXAPISR. You can use whatever you want, but I would recommend coming up with a prefix that you use consistently throughout Maximo to indicate that it's something your company has configured.
2) Delete the child objects you won't be using. Most of these (like SITE) were used for retrieval of information and should have never been part of the object structure anyways. I deleted all of them because I just plan to send COMMLOG
3) Add COMMLOG as a new object. Parent Object is SR and relationship is COMMLOG

Once you save that we're ready to try and make the request.
Method of PATCH is logical but you actually need it to be a POST with some headers to indicate that it's an update. I'll provide you values as a starting point and then go into some details below that.
URI: https://site.com/maximo/api/os/emxapisr?lean=1
Method: POST
headers:
x-method-override: SYNC
patchtype: MERGE
apikey: YOURAPIKEY
body:
{
"ticketid":"1001",
"class":"SR",
"commlog":[
{
"sendfrom":"myemail@company.com",
"createby":"MAXADMIN",
"subject":"This is your email subject",
"message":"This is your email body",
"inbound":true
}
]
}
The lean=1 allows us to avoid some OSLC concept such as namespaces (the spi: prefix) and reduces the size of the JSON becuse of it. The x-method-override of SYNC allows us to not need to provide the href of the record in question, just the unique key required for our framework to be able to find the record (ticketid & class in this case). I find this easier for integrations like this so you don't need to make a secondary call to retrieve the href.
You had listed the createby as an email address but createby should correspond to a PERSONID in Maximo. I hardcoded this to MAXADMIN in my example for simplicity. Email listener would normally set the SENDFROM attribute to the email address it came from so I set that in my example. I also indicated that it was inbound to show that it wasn't sent from Maximo to the user but processed into Maximo. This has no functional impact, but I think it's helpful information for reporting purposes.
And if you did everything correctly you should see something like:
------------------------------
Steven Shull
Original Message:
Sent: Thu March 30, 2023 10:28 AM
From: Christopher Stewart
Subject: Is it possible to create a communication log entry via rest api?
I am just looking to store a communication log, not send one. Our IT department will not allow the Maximo email listener to be set up to store communication replies from emails. I would like to use MS power automate to do that same thing. When a new email arrives from Maximo, make a post request and update the necessary service request with the data from the email.
I am attempting to do something like the following. What would the URL be to create a new commlog?
------------------------------
Christopher Stewart
Original Message:
Sent: Thu March 30, 2023 09:09 AM
From: Steven Shull
Subject: Is it possible to create a communication log entry via rest api?
Are you looking to store it or actually send the email. Assuming you want to send the email, I documented this as a REST API action automation script here: https://ibm-maximo-dev.github.io/maximo-autoscript-documentation/rest/osaction
If you wanted to store the data (but not trigger an email) you should be able to add commlog as a child object and provide that on the POST request.
------------------------------
Steven Shull
Original Message:
Sent: Wed March 29, 2023 03:26 PM
From: Christopher Stewart
Subject: Is it possible to create a communication log entry via rest api?
I would like to create communication log entries for service requests via rest api. Is this possible? Any examples on what needs to be passed for data/syntax?
------------------------------
Christopher Stewart
------------------------------
#MaximoIntegrationandScripting
#Maximo