Skip to main content
Expert
March 21, 2022

DM Job calling through API

  • March 21, 2022
  • 3 replies
  • 0 views

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

 

 

3 replies

Veteran
March 21, 2022

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

 

KrishnaAuthor
Expert
March 21, 2022

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.

Veteran
March 22, 2022

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.

RESTAPI.png

Newcomer
March 24, 2022

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

Contributor
August 7, 2024

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

Thanks 

Sridhar

KrishnaAuthor
Expert
August 7, 2024

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

Krishna_0-1723058048612.png