Rest API for failed message into an action

Is there any way to capture the failed message only or the step where actually script failed via rest api

(detailed status of results of it, line numbers of results of it , action scripts of it) of bes actions whose (id of it equals 1652)

Completed action uses wow64 redirection false

Completed action parameter query “user” with description “Please enter the user name”

Completed action parameter query “group” with description “Please enter the group name”

Completed if {exists names whose (it = parameter “user”) of local users}

Failed if {exists names whose (it = parameter “group”) of local group} **
** waithidden net localgroup administrators “{parameter “user”}” /add

else
exit group not found
endif
else
exit user not found
endif

Yes, in Fixlet Debugger but your issue is the plurality - you are referring to “local group” where there will never be just “one” on Windows machines, so change it to “local groups”.

exists names whose (it = parameter “group”) of local groupS

Also, you may want to look into the case-sensitivity of all your relevance statements cause the way you have it you are relying on the operator to get them exactly right each time… Consider the following example:
q: exists names whose (it = “administrators”) of local groups
A: False
T: 12.318 ms
I: singular boolean

q: exists names whose (it = “Administrators”) of local groups
A: True
T: 5.344 ms
I: singular boolean

You really should look into something along the lines of (and same for the user too really):
exists names whose (it as lowercase = (parameter “group” as lowercase)) of local groups

Hi, my query is bit different.

i am looking out how to get the action output only to specific error for an action via rest api connection for failed action

However i would consider your input
thanks

(detailed status of results of it, line numbers of results of it , action scripts of it) of bes actions whose (id of it equals 1652)

You can’t really do that. The RestAPI can only give you what you have. You can potentially split the action script into “lines” (instead of one single string) but even if you do, you won’t be able to match the “line number” from the result to the action script because it’s not 1-to-1…

if {exists names whose (it = parameter “group”) of local group}
waithidden net localgroup administrators “{parameter “user”}” /add
else
exit group not found
endif

Would essentially be 5 lines of action script but in reality as far as the execution is concerned it’s a single line of execution…

My suggestion is to rewrite your action and put in Exit Codes and this you can easily retrieve back via RestAPI:
if {exists names whose (it = parameter “user”) of local users}
if {exists names whose (it = parameter “group”) of local groups}
waithidden net localgroup administrators “{parameter “user”}” /add
exit 0
else
exit 1 // Group not found
endif
else
exit 2 // User not found
endif

1 Like

Thanks for your help. can you pls let me know how actually to get the exit code into rest api call?

(detailed status of it, (if (exist exit code of it) then (exit code of it as string) else (“N/A”))) of results of bes actions whose (id of it equals 1652)

1 Like

Results
The action failed., N/A

exit code does not display as i think we need to add action script of it as well but no exit code display

(action script of it ,(if (exist exit code of it) then (exit code of it as string) else (“N/A”))) of bes actions whose (id of it equals 1653) ???

Correct. Exit Code is very much dependent on how the fixlet is defined and not all fixlets would actually produce an Exit Code, even if executed successfully/have failed.

1 Like