Normally, yes, the Q0N... portion of that URL can be retrieved by running something like this:
GET https://localhost/maximo/oslc/os/mxwo?lean=1&oslc.select=wonum,siteid&oslc.where=wonum="WO1943437"
maxauth: BASICHUNG2WQ==
... and getting the HREF value that comes back. In this case, I took the Site ID of CCCN and the WO Num of WO1943437 and combined them into a string CCCN/WO1943437 and Base64 encoded that string (this is essentially what Maximo does as Steven described).
Remember to duplicate the MXWO object structure as Steven said before modifying it to include the WORKLOG object. That's a good practice as I've seen certain processes break by modifying out of the box object structures.
Hope this helps,
------------------------------
Alex Walter
A3J Group, LLC
------------------------------
Original Message:
Sent: 11-11-2021 09:53
From: alvaro molano
Subject: create a new worklog in an existing work order WO
alex thanks for taking the time to read and reply this, i really appreciatte your concern!
one Q where did u get this url?
"https://localhost/maximo/oslc/os/mxwo/Q0NDTi9XTzE5NDM0Mzc=?lean=1"
from href field from GET request?
how did u request for that? any example?
------------------------------
alvaro molano
kio
Original Message:
Sent: 11-11-2021 09:37
From: Alex Walter
Subject: create a new worklog in an existing work order WO
Agreed with everything that @Steven Shull said.
A sample URL might look like this:
POST https://localhost/maximo/oslc/os/mxwo/Q0NDTi9XTzE5NDM0Mzc=?lean=1
maxauth: BASICHUNG2WQ==
x-method-override: PATCH
patchtype: MERGE
Content-Type: application/json
A sample payload might look like this:
{
"worklog": [
{
"logtype": "CLIENTNOTE",
"description": "update",
"description_longdescription": "stextexetetxet<!-- RICH TEXT -->"
}
]
}
Hope this helps,
------------------------------
Alex Walter
A3J Group, LLC
Original Message:
Sent: 11-10-2021 09:06
From: Steven Shull
Subject: create a new worklog in an existing work order WO
MXWO out of the box doesn't include WORKLOG and I would not recommend modifying out of the box object structures. I would duplicate the object structure, add WORKLOG as a child object, and set the relationship to MODIFYWORKLOG (to avoid a GET request retrieving the entire worklog table).
You shouldn't provide most of the attributes you listed when creating a WORKLOG. EX: recordkey, class, siteid, logtype_description, rowstamp, modifyby, modifydate, etc. as that will just increase your payload size and isn't needed to create a work log entry.
Are you making the GET request to get your HREF for that Work Order? IE after /mxwo do you have /_LONGSTRING? That string is the base 64 encoding of the primary keys of the object (so siteid & wonum in this case).
I would make sure that you're making the request to the correct HREF, that the object structure is defined correctly, and simplify your payload to only the necessary fields and see what happens.
------------------------------
Steven Shull
IBM
Original Message:
Sent: 11-05-2021 16:04
From: alvaro molano
Subject: create a new worklog in an existing work order WO
hi guys,
im using the MAXIMO REST API to make some queries, using get and post operations.
i wanna ask if somebody knows how to create a new worklog in an existing WO:
im trying this:
url_lref2='https://localhost/maximo/oslc/os/mxwo?lean=1&oslc.select=*&oslc.where=wonum="WO1943437"' --- > look for WO1943437
r_ref3 = session.post(href_str,headers=myheaders,json=jedi)
but im still getting 204 responde(no content)
my headers are:
myheaders = {
'maxauth': 'BASICHUNG2WQ==',
'x-method-override': 'PATCH',
'patchtype': 'MERGE',
'Content-Type': 'application/json',
'accept': "application/json"
}
and the JSON body is:
jedi={
"worklog":
{
"modifyby": "USERNAME",
"description_longdescription": "stextexetetxet<!-- RICH TEXT -->",
"createdate": "2021-11-05T10:19:14-05:00",
"description": "update",
"orgid": "TEXHERE",
"langcode": "ES",
"_rowstamp": "268199803527",
"createby": "USERNAME",
"logtype": "CLIENTNOTE",
"modifydate": "2021-11-05T10:19:54-05:00",
"recordkey": "WO1943437",
"siteid": "CCCN",
"class": "WORKORDER",
"logtype_description": "Client Note"
}
}
please any hint would be awesome.
thanks for reading!
#MaximoUserGroups
------------------------------
alvaro molano
kio
------------------------------