DM Job calling through API

Krishna
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
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

 

Connect with me on:
LinkedIn: https://www.linkedin.com/in/nicolas-argente/
Website: https://aiqos.io
If you want to lift yourself up, lift up someone else.

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

Connect with me on:
LinkedIn: https://www.linkedin.com/in/nicolas-argente/
Website: https://aiqos.io
If you want to lift yourself up, lift up someone else.

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