cancel
Showing results for 
Search instead for 
Did you mean: 

DM Job calling through API

KrishnaS
New Contributor III

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

 

 

4 REPLIES 4

NicolasArgente
Contributor II

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

 

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.

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

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