Hi Nina,
Sounds like you know all the pieces of the puzzle already, you just have to put them together. For starters, you write "ExecuteProcessWithReturn, which should have a navigation property of ErrorLogFile", which makes me think you likely forgot to add the $expand query option specifying you wanted that 'ErrorLogFile' property to be expanded into the result (note: navigation properties are not returned by default but have to be explicitly included in the response by specifying them in the $expand query option - see section 11.2.4.2 in the OData Protocol specification).
With that information in the response to the ExecuteProcessWithReturn you can indeed then request the content of that ErrorLogFile using the ErrorLogFile's 'Content' property as you show above already.
PS, presuming you are running a registered process, do you know you can call the ExecuteWithReturn action on that process directly as well? For example, using the 'Mover' process from the Planning Sample database, you can combine all this together and call (presuming {{serviceRootUrl}} is set to your TM1 Server's service root URL - in your examples 'http://localhost:12345/api/v1):
POST {{serviceRootUrl}}/Processes('Mover')/tm1.ExecuteWithReturn?$expand=ErrorLogFile
Content-Type: application/json
Accept: application/json;odata.metadata=none
{}
after which you retrieve the result of that previous 'executeProcess' request as in:
GET {{serviceRootUrl}}/ErrorLogFiles('{{executeProcess.response.body.ErrorLogFile.Filename}}')/Content
Note that in this GET request I explicitly don't specify an Accept header, which translates to accepting all mime-types, as the result of content in this case is `text/plain`.
Cheers,
------------------------------
Hubert Heijkers
------------------------------
Original Message:
Sent: Thu March 18, 2021 10:07 AM
From: Nina Gordy
Subject: Accessing a TI process's error log after ExecuteProcessWithReturn
I'm using the REST API to kick off a TI process on the server and am receiving the ProcessExecuteResult object after calling ExecuteProcessWithReturn, which should have a navigation property of ErrorLogFile. What's the best way to get to that ErrorLogFile? I know I can access the list of error log files using the following:
http://localhost:12354/api/v1/Processes(<<PROCESS NAME>>)?$expand=ErrorLogs
And I know I can get the contents of one log file using:
http://localhost:12354/api/v1/ErrorLogFiles(<<LOG FILE NAME>>)/Content
However, I need to go directly from running the process to the error log file (assuming the process produces an error). What call can I make to the server to achieve this?
------------------------------
Nina Gordy
------------------------------
#PlanningAnalyticswithWatson