Where to find API Logs?

Does IEM have any logs for the API requests so that we can figure out whats happening server side when it starts throwing HTTP 500 or other errors?

The Root Server is responsible for RESTAPI requests. Information about the Root Server log is available here via IBM Knowledge Center. You may need to increase the verbosity of the logging.

What is your RESTAPI request?

Im POST’ing to /api/actions the action explain in thread Securely creating fixlets to update OS user passwords . It works if open that BES action from the console but not if I submit it through the API for some reason.

What are you using to talk with the Root Server?

We have an example of how you can use cURL to make RESTAPI requests. For this specific case, check how we create actions.

Im using a RESTFUL Ruby client wrapper around the IEM API. Im confident its not the wrapper as I can add an action ok if I first export an existing one from the console and then post it back via the API. But the original one as shown in that thread throws an HTTP 500 error when I attempt to post it.

Is it possible get your copy of the action XML?

>> puts action_template.to_s
<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
  <SourcedFixletAction>
<SourceFixlet>
  <Sitename>master</Sitename>
  <FixletID>79706</FixletID>
  <Action>Action1</Action>
</SourceFixlet>
<Target>
  <ComputerName>testcomputer.domain</ComputerName>
</Target>
<Parameter Name="username">tester</Parameter>
<SecureParameter Name="password"><![CDATA[test13_password]]></SecureParameter>
</SourcedFixletAction>
</BES>

Where the fixlet is already in “Master Action Site” according to the console.

Actual fixlet:

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
<Fixlet>
<Title>Change local user account password - Linux</Title>
<Description>This script changes the local account password for a Linux user. It expects parameters to be passed in through action, with the password sent in securely for ease of automation.</Description>
<Relevance><![CDATA[version of client >= "9.0"]]></Relevance>
<Relevance>name of operating system starts with "Linux"</Relevance>
<Category>Accounts</Category>
<DownloadSize>0</DownloadSize>
<Source>Internal</Source>
<SourceID>IBM-ISIE-001-CHPASSWD-LIN</SourceID>
<SourceReleaseDate>2014-11-26</SourceReleaseDate>
<SourceSeverity></SourceSeverity>
<CVENames></CVENames>
<SANSID></SANSID>
<Domain>BESC</Domain>
<DefaultAction ID="Action1">
  <Description>
    <PreLink></PreLink>
    <Link>Change</Link>
    <PostLink><![CDATA[&nbsp;specified local user account password.]]></PostLink>
  </Description>
  <ActionScript MIMEType="application/x-Fixlet-Windows-Shell">
    <![CDATA[
             wait sh -c "chpasswd <<< "{parameter "username" of action}:{parameter "password" of action}""
             continue if {exists true whose (if true then (exit code of action = 0) else false)}
    ]]>
  </ActionScript>
  <SuccessCriteria Option="RunToCompletion"></SuccessCriteria>
</DefaultAction>
</Fixlet>
</BES>

Is this the complete XML?

It’s missing a close element for <SourcedFixletAction> and <BES>. Try with a file with contents:

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
	<SourcedFixletAction>
		<SourceFixlet>
			<Sitename>master</Sitename>
			<FixletID>79706</FixletID>
			<Action>Action1</Action>
		</SourceFixlet>
		<Target>
			<ComputerName>testcomputer.domain</ComputerName>
		</Target>
		<Parameter Name="username">tester</Parameter>
		<SecureParameter Name="password"><![CDATA[test13_password]]></SecureParameter>
	</SourcedFixletAction>
</BES>

Sorry that was a copy/paste typo on my part, yes it is closed properly on the file I was using. Updated the provided examples.

What version is your Root Server?

Is ```master` the name of a custom site? If you are trying to reference the actionsite, try with the string “ActionSite”.

I’m not familiar with RESTFUL Ruby client wrapper. Is it possible to configure that to output out the HTTP body in the response?

It seems very likely the HTTP body would say something like:

Site "master" does not exist.

When I set to ActionSite the response using straight curl is HTTP 400 “Bad Request: (no reason given)” and when set to “master” it says as you expected “Stie “master” does not exist”.

However, when I query GET /api/sites it is one of the available sites:

	<ActionSite Resource="https://localhost:52311/api/site/master">
	<Name>ActionSite</Name>
</ActionSite>

I’m not quite sure why this is happening. Using “ActionSite” (or the name of a custom site), I’m able to take an action against a source Fixlet.

At this point, I would suggest containing support.

FYI - I encountered this same error. For me the fix was to specify ComputerID instead of ComputerName in the Target section.

1 Like