03-21-2022 08:24 AM
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
03-21-2022 11:04 AM
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
03-21-2022 01:42 PM - edited 03-21-2022 01:43 PM
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.
03-22-2022 03:08 AM - edited 03-22-2022 03:19 AM
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.
03-24-2022 01:19 PM
REST will not work with a native auth. You'll have to use the Client API if you want to continue with native.