I've created a Powershell-connector and you can't believe what happened next

I'm trying to get all users from an API through Invoke-RestMethod, and have created the definition file and created the sync project. When clicking on User (All) the script gets all users from the API but I can't figure out how the logic works (or doesn't work) when I want to view just one object.

I've created to custom commands in the xml, Get-ACMEUsers and Get-ACMEUser. The both take four parameters for the actual connection, and Get-ACMEUser have an additional parameter for defining the actual user to get.

What I don't understand is how to get the command to take the actual object that I click on when I browse and get that as a parameter on the Get-ACMEUser command. If I specify which user to get with the fixed value parameter it works, but it shows the same user independent of which user I click on to view.

My custom command wants a user name in a string, and I'm limited to String, Int, DateTime and Bool. I can't "send" the entire object.

<ReadConfiguration>
	<ListingCommand Command="Get-ACMEUsers">
		<SetParameter Param="Domain" Source="GlobalVariable" Value="_domain" />
		<SetParameter Param="RestUri" Source="GlobalVariable" Value="_restUri" />
		<SetParameter Param="CertificateThumbprint" Source="GlobalVariable" Value="_certThumb" />
		<SetParameter Param="APIkey" Source="GlobalVariable" Value="_apiKey" />
	</ListingCommand>
	<CommandSequence>
		<Item Command="Get-ACMEUser" Order="1" >
			<SetParameter Param="Domain" Source="GlobalVariable" Value="_domain" />
			<SetParameter Param="RestUri" Source="GlobalVariable" Value="_restUri" />
			<SetParameter Param="CertificateThumbprint" Source="GlobalVariable" Value="_certThumb" />
			<SetParameter Param="APIkey" Source="GlobalVariable" Value="_apiKey" />
			<SetParameter Param="Id" Source="FixedValue" Value="joedoe2020" />
		</Item>
	</CommandSequence>
</ReadConfiguration>

Also, I have two attributes returned from the API that according to Powershell are String but I get an error when the connector is trying to map the two attributes.

This is the error message I get:

[1777160] Property (ValidFrom@User) could not read the value from system object (joedoe2020)!
[1777022] Schema property (ValidFrom@User) only accepts data of type (System.DateTime).
The value loaded (2020-11-27T10:30:20.149) is however type (System.String).

Any help is greatly appreciated!

PS. One Identity 8.1.3, Windows Server 2016, SQL Server 2016 CU15

Parents Reply
  • I've tried both DateTime and String, and also tried ValidFrom.ToString() in the Path.

    And now I see that all of my attributes are read-only. Is there a setting in the xml that I may have forgotten? EDIT: after configuring two MethodConfiguration in the xml I now have to methods and the attributes are no longer read-only. Also, I had forgot to update schema after adding the method configuration to the xml-definition.

    Still looking for a solution for the DateTime/String conundrum..

Children
  • In regards to read-only, I assume you missed the command mappings in the schema definition of the properties. There is a sample XML in the product delivery that explains these settings in the comments. "<OneIM>\Modules\TSB\dvd\AddOn\SDK\ADSample.XML"

    In this sample, you can as well see how to change the data type of some return value of your called CMDlets. In the return bindings of ObjectGUID the code ObjectGuid.ToString() converts the data type of the returned ObjectGuid to a string. I believe you could do something similar with your DateTimes.