Forum Discussion

Krishna's avatar
Krishna
Valued Contributor
3 years ago

DM Job calling through API

Hi - I am trying to call the DM job using RESTAPI call from Powershell using Basic Authentication . It is an On-Premise Environment and Version is 6.6. I know I can use the task scheduler but I requirement is to use the API. 

I have a PS Script but it failing and also failing in Postman with 404. The below is the script

 

$User = ""
$Token = ""
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($User):$($Token)"))
$Header = @{
Authorization = "Basic $base64AuthInfo"
ACCEPT="application/json"
}

$ContentType = "application/json"
$Url = "http://Host:Port/api/DataManagement/ExecuteStep"
$Body = @{
SequenceName="Sample"
BaseWebServerUrl="http://Host:Port/OneStream"
ApplicationName="Sample"
}

$json = $body | Convertto-JSON
Invoke-RestMethod -Method 'Post' -Uri $url -Headers $Header -Body $json

 

Any help would be appreciated.

 

Thanks

Krishna

 

 

  • NicolasArgente's avatar
    NicolasArgente
    Valued Contributor

    Hi KrishnaSrini,

    The issue is coming from the fact that you are using Native Authentication. You must be using Azure, Okta Or Pingfederate to have this working.  Please check the pre requisites on the REST API Implementation Guide 6.8.1
    Please give a kudo if it helps,
    Thanks

     

    • Krishna's avatar
      Krishna
      Valued Contributor

      Thanks and follow up question. Will it not work for Basic Authentication ? BTW I already gone through the Documentation for the SSO for the API.

      • NicolasArgente's avatar
        NicolasArgente
        Valued Contributor

        Unfortunately, it will not work without an external authenticator. Not that I am aware of at least 🙂
        Did you set up the server config?
         example for azure : The lines in red are for your RESTAPI. The line in purple is the only one used in your Postman. The other lines in red block are used in the URL to Microsoft to retrieve the temporary token.

  • REST will not work with a native auth. You'll have to use the Client API if you want to continue with native.

  • Do we still need to use PowerShell to call DM Jobs in version 8.2.2, or has this process been simplified?

    Thanks 

    Sridhar

    • Krishna's avatar
      Krishna
      Valued Contributor

      You can use the RESTAPI in 8.2.2 with the Token. It can be generated from Identify and Access Management Portal.