Replacing a schedule via API throws Internal Server Error

I am attempting to replace an existing schedule via the REST api (as in the documentation)

curl -X PUT
-H “Content-type: application/json”
-H “Authorization: Bearer $TOKEN”
“``https://$HOSTNAME/api/v2/orchestration/schedules/ri.scheduler.main.schedule.5ad5c340-59f3-4a60-9fc6-161bb984f871?preview=true”``
-d ‘{“displayName”:“My Daily Schedule”,“description”:“Run all the transforms at midnight”,“action”:{“abortOnFailure”:false,“forceBuild”:false,“retryBackoffDuration”:{“unit”:“SECONDS”,“value”:30},“retryCount”:1,“fallbackBranches”:,“branchName”:“master”,“notificationsEnabled”:false,“target”:{“type”:“manual”,“targetRids”:[“ri.foundry.main.dataset.b737e24d-6b19-43aa-93d5-da9fc4073f6e”,“ri.foundry.main.dataset.d2452a94-a755-4778-8bfc-a315ab52fc43”]}},“trigger”:{“type”:“time”,“cronExpression”:“0 0 * * *”,“timeZone”:“UTC”},“scopeMode”:{“type”:“user”}}’

as per the documentation here.

https://www.palantir.com/docs/foundry/api/v2/orchestration-v2-resources/schedules/replace-schedule/

No issues with authentication and the payload changed appropriately.

But it gives this error:

{“errorCode”:“INTERNAL”,“errorName”:“Default:Internal”,“errorInstanceId”:“0a5ff031-1d46-43a0-88ab-8ceeefd8901e”,“parameters”:{}}

Same response with both ‘curl’ & ‘python’

What could be the issue?

Hey,

Thanks for reporting this. The response itself is an API bug where an internal error is being returned instead of the correct BuildTargetsResolutionError response. The fix to this behavior is on the way.

Regarding the BuildTargetsResolutionError issue that you’re hitting, this means one or both of your target resources (ri.foundry.main.dataset.b737e24d-6b19-43aa-93d5-da9fc4073f6e , ri.foundry.main.dataset.d2452a94-a755-4778-8bfc-a315ab52fc43) are not buildable by your token. This could be either because the resources don’t have transforms deployed on them, or because the token used for this request lacks build permissions on them.

The permissions piece could also be related to the fact that your request has the scopeMode set to {"type":"user"}. I’d recommend switching this to project-scoped mode: https://www.palantir.com/docs/foundry/building-pipelines/scheduling-best-practices/#project-scoped-schedules

Thank you for the response. While I wait for the API update, a quick question on the permissions granted to the ‘token’

I can edit the schedule of this dataset (in the ‘targetRids’) via the UI/Portal.

Does the API token I have created for myself have the same permissions as me logged into the UI? Assuming yes, but would like to confirm.

Thank you very much

Ashok

The token permissions are based how that token was created and configured.

For example, a temporary development token would hold the same permissions as the user who generated it.

However, OAuth2 applications can have a further restricted permissions than their creator user where their access is configured in the corresponding Developer Console application and service user settings. See Authentication for production apps and Developer console application scopes sections of the docs for more on details.