<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article Connecting to the Enterprise Manager using the .NET client (&amp;amp; PowerShell script) in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/Connecting-to-the-Enterprise-Manager-using-the-NET-client-amp/ta-p/1758541</link>
    <description>&lt;H4&gt;Environment&lt;/H4&gt;
&lt;UL&gt;
&lt;LI&gt;Enterprise manager 6.4 and above&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The Enterprise Manager supplies 3 types of clients:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;REST&lt;/LI&gt;
&lt;LI&gt;Dotnet (using dlls)&lt;/LI&gt;
&lt;LI&gt;Python (using py files)&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;FONT color="#00CCFF"&gt;&lt;STRONG&gt;Client Modules&lt;BR /&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;In this session we use the DotNet client tools to do the connection.&lt;BR /&gt;The location the dotnet dll files (py files for Python) is on:&lt;BR /&gt;&amp;lt;AEM installation folder&amp;gt;\clients\dotnet&lt;/P&gt;
&lt;P&gt;The folder contains two dlls and one cs file:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;AemRestClient.dll&lt;/LI&gt;
&lt;LI&gt;Newtonsoft.Json.dll&lt;/LI&gt;
&lt;LI&gt;An example cs project.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Though not obligatory, copy the dll files to the working directory.&lt;BR /&gt;To enable PowerShell using these files, use the following command:&lt;/P&gt;
&lt;P&gt;Import-Module&lt;/P&gt;
&lt;P&gt;*If none is available in your organization the API could be approached directly.&lt;BR /&gt;Use the documentation (User guide).&lt;/P&gt;
&lt;P&gt;e.g.&lt;BR /&gt;Use the following script to import the files:&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="623"&gt;
&lt;P&gt;clear&lt;BR /&gt;#Importing modules&lt;BR /&gt;$DotNetFolder = Split-Path $script:MyInvocation.MyCommand.Path&lt;BR /&gt;$DotNetRESTFile = $DotNetFolder + "\AemRestClient.dll"&lt;BR /&gt;$DotNetRESTFileJSON = $DotNetFolder + "\Newtonsoft.Json.dll"&lt;BR /&gt;Import-Module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $DotNetRESTFile -ErrorAction Stop&lt;BR /&gt;Import-Module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $DotNetRESTFileJSON -ErrorAction Stop&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00CCFF"&gt;&lt;STRONG&gt;Authentication and Authorization&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The AEM REST API uses the BASIC HTTP authorization scheme to authenticate callers and create a client session.&lt;/LI&gt;
&lt;LI&gt;A client session is established using the AemLogin method, which returns the special header “EnterpriseManager.APISessionID” with a value (session token) that needs to be sent as a request header in following requests.&lt;BR /&gt;This token is transparent to the dll users.&lt;/LI&gt;
&lt;LI&gt;A session token expires &lt;STRONG&gt;5 minutes&lt;/STRONG&gt; after the last request. &lt;BR /&gt;After the session expires, the caller must re-authenticate to establish a new session.&lt;/LI&gt;
&lt;LI&gt;Authorization for performing a specific REST request relies on permission, assigned to the authenticated user either directly or by means of group membership.&lt;/LI&gt;
&lt;LI&gt;Each REST request requires a minimum role, which is specified in the section describing the request.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;FONT color="#00CCFF"&gt;&lt;STRONG&gt;Connecting to an AEM Server – Aem.RestClient&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Initiating a connection to AEM is done by creating an object that contains all the methods necessary for working with the API.&lt;/P&gt;
&lt;P&gt;The function is:&lt;BR /&gt;Attunity.Aem.RestClient.AemRestClien&lt;BR /&gt;It accept three parameters:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Credential.&lt;/LI&gt;
&lt;LI&gt;The Enterprise Manager URL.&lt;/LI&gt;
&lt;LI&gt;verifyCertificate ($True/$False)&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;E.g.&lt;BR /&gt;$AEMServerConnection = New-Object Attunity.Aem.RestClient.AemRestClient($Credential, $AemURL, $false)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00CCFF"&gt;&lt;STRONG&gt;Final&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;To connect to Enterprise Manager you need to follow these steps:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Load the client modules&lt;/LI&gt;
&lt;LI&gt;Gain credentials&lt;/LI&gt;
&lt;LI&gt;Use the Attunity.Aem.RestClient.AemRestClient module to do the actual connection.&lt;/LI&gt;
&lt;LI&gt;Repeat step 3 whenever you are disconnected.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;The following script accepts credentials from the user and connect to an Enterprise Manager machine:&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;clear&lt;BR /&gt;#Importing modules&lt;BR /&gt;$DotNetFolder = Split-Path $script:MyInvocation.MyCommand.Path&lt;BR /&gt;$DotNetRESTFile = $DotNetFolder + "\AemRestClient.dll"&lt;BR /&gt;$DotNetRESTFileJSON = $DotNetFolder + "\Newtonsoft.Json.dll"&lt;BR /&gt;Import-Module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $DotNetRESTFile -ErrorAction Stop&lt;BR /&gt;Import-Module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $DotNetRESTFileJSON -ErrorAction Stop&lt;BR /&gt;#Accept the AEM server name&lt;BR /&gt;function Get-AEMServerAndUserName($AEM_Server_Name)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $script:AemServerName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = $AEM_Server_Name&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;$AEMServerAndUserName = Invoke-Expression (Show-Command Get-AEMServerAndUserName -PassThru)&lt;BR /&gt;#Connecting to the server&lt;BR /&gt;$AemUserName = $env:userdomain + '\' + $env:username&lt;BR /&gt;$Credential = Get-Credential&amp;nbsp; -Message $AEMServerName -UserName $AemUserName&lt;BR /&gt;$AemURL = "https://" + $AEMServerName + "/attunityenterprisemanager"&lt;BR /&gt;$AEMServerConnection = New-Object Attunity.Aem.RestClient.AemRestClient($Credential, $AemURL, $false)&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;End.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Nov 2020 16:46:08 GMT</pubDate>
    <dc:creator>Yossi_Shalom</dc:creator>
    <dc:date>2020-11-04T16:46:08Z</dc:date>
    <item>
      <title>Connecting to the Enterprise Manager using the .NET client (&amp; PowerShell script)</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/Connecting-to-the-Enterprise-Manager-using-the-NET-client-amp/ta-p/1758541</link>
      <description>&lt;H4&gt;Environment&lt;/H4&gt;
&lt;UL&gt;
&lt;LI&gt;Enterprise manager 6.4 and above&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The Enterprise Manager supplies 3 types of clients:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;REST&lt;/LI&gt;
&lt;LI&gt;Dotnet (using dlls)&lt;/LI&gt;
&lt;LI&gt;Python (using py files)&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;FONT color="#00CCFF"&gt;&lt;STRONG&gt;Client Modules&lt;BR /&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;In this session we use the DotNet client tools to do the connection.&lt;BR /&gt;The location the dotnet dll files (py files for Python) is on:&lt;BR /&gt;&amp;lt;AEM installation folder&amp;gt;\clients\dotnet&lt;/P&gt;
&lt;P&gt;The folder contains two dlls and one cs file:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;AemRestClient.dll&lt;/LI&gt;
&lt;LI&gt;Newtonsoft.Json.dll&lt;/LI&gt;
&lt;LI&gt;An example cs project.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Though not obligatory, copy the dll files to the working directory.&lt;BR /&gt;To enable PowerShell using these files, use the following command:&lt;/P&gt;
&lt;P&gt;Import-Module&lt;/P&gt;
&lt;P&gt;*If none is available in your organization the API could be approached directly.&lt;BR /&gt;Use the documentation (User guide).&lt;/P&gt;
&lt;P&gt;e.g.&lt;BR /&gt;Use the following script to import the files:&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="623"&gt;
&lt;P&gt;clear&lt;BR /&gt;#Importing modules&lt;BR /&gt;$DotNetFolder = Split-Path $script:MyInvocation.MyCommand.Path&lt;BR /&gt;$DotNetRESTFile = $DotNetFolder + "\AemRestClient.dll"&lt;BR /&gt;$DotNetRESTFileJSON = $DotNetFolder + "\Newtonsoft.Json.dll"&lt;BR /&gt;Import-Module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $DotNetRESTFile -ErrorAction Stop&lt;BR /&gt;Import-Module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $DotNetRESTFileJSON -ErrorAction Stop&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00CCFF"&gt;&lt;STRONG&gt;Authentication and Authorization&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The AEM REST API uses the BASIC HTTP authorization scheme to authenticate callers and create a client session.&lt;/LI&gt;
&lt;LI&gt;A client session is established using the AemLogin method, which returns the special header “EnterpriseManager.APISessionID” with a value (session token) that needs to be sent as a request header in following requests.&lt;BR /&gt;This token is transparent to the dll users.&lt;/LI&gt;
&lt;LI&gt;A session token expires &lt;STRONG&gt;5 minutes&lt;/STRONG&gt; after the last request. &lt;BR /&gt;After the session expires, the caller must re-authenticate to establish a new session.&lt;/LI&gt;
&lt;LI&gt;Authorization for performing a specific REST request relies on permission, assigned to the authenticated user either directly or by means of group membership.&lt;/LI&gt;
&lt;LI&gt;Each REST request requires a minimum role, which is specified in the section describing the request.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;FONT color="#00CCFF"&gt;&lt;STRONG&gt;Connecting to an AEM Server – Aem.RestClient&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Initiating a connection to AEM is done by creating an object that contains all the methods necessary for working with the API.&lt;/P&gt;
&lt;P&gt;The function is:&lt;BR /&gt;Attunity.Aem.RestClient.AemRestClien&lt;BR /&gt;It accept three parameters:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Credential.&lt;/LI&gt;
&lt;LI&gt;The Enterprise Manager URL.&lt;/LI&gt;
&lt;LI&gt;verifyCertificate ($True/$False)&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;E.g.&lt;BR /&gt;$AEMServerConnection = New-Object Attunity.Aem.RestClient.AemRestClient($Credential, $AemURL, $false)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#00CCFF"&gt;&lt;STRONG&gt;Final&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;To connect to Enterprise Manager you need to follow these steps:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Load the client modules&lt;/LI&gt;
&lt;LI&gt;Gain credentials&lt;/LI&gt;
&lt;LI&gt;Use the Attunity.Aem.RestClient.AemRestClient module to do the actual connection.&lt;/LI&gt;
&lt;LI&gt;Repeat step 3 whenever you are disconnected.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;The following script accepts credentials from the user and connect to an Enterprise Manager machine:&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;clear&lt;BR /&gt;#Importing modules&lt;BR /&gt;$DotNetFolder = Split-Path $script:MyInvocation.MyCommand.Path&lt;BR /&gt;$DotNetRESTFile = $DotNetFolder + "\AemRestClient.dll"&lt;BR /&gt;$DotNetRESTFileJSON = $DotNetFolder + "\Newtonsoft.Json.dll"&lt;BR /&gt;Import-Module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $DotNetRESTFile -ErrorAction Stop&lt;BR /&gt;Import-Module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $DotNetRESTFileJSON -ErrorAction Stop&lt;BR /&gt;#Accept the AEM server name&lt;BR /&gt;function Get-AEMServerAndUserName($AEM_Server_Name)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $script:AemServerName&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = $AEM_Server_Name&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;$AEMServerAndUserName = Invoke-Expression (Show-Command Get-AEMServerAndUserName -PassThru)&lt;BR /&gt;#Connecting to the server&lt;BR /&gt;$AemUserName = $env:userdomain + '\' + $env:username&lt;BR /&gt;$Credential = Get-Credential&amp;nbsp; -Message $AEMServerName -UserName $AemUserName&lt;BR /&gt;$AemURL = "https://" + $AEMServerName + "/attunityenterprisemanager"&lt;BR /&gt;$AEMServerConnection = New-Object Attunity.Aem.RestClient.AemRestClient($Credential, $AemURL, $false)&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;End.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2020 16:46:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/Connecting-to-the-Enterprise-Manager-using-the-NET-client-amp/ta-p/1758541</guid>
      <dc:creator>Yossi_Shalom</dc:creator>
      <dc:date>2020-11-04T16:46:08Z</dc:date>
    </item>
  </channel>
</rss>

