Forum Discussion
Not able to delete a job instance using the Delete API
- 5 months ago
Hi ISHPREETKaur
Sorry to know it didn't work!
Could you try creating a SJD using Fabric UI, then deleting it using the REST API using the process above? This will rule out if anything is wrong in the creation process.
Hello ISHPREETKaur
I have been able to delete SJD using the REST API, even though it had job instances linked to it. You must have Write permissions on the Spark Job Definition to be able to delete it.
If you have created a SJD using your identity, you can try the REST API directly using the links below.
Lists SJD for your workspace
Items - List Spark Job Definitions - REST API (SparkJobDefinition) | Microsoft Learn
Deletes SJD using Id from the above link.
Items - Delete Spark Job Definition - REST API (SparkJobDefinition) | Microsoft Learn
Hi deborshi_nag ,
I am getting this bad request error while trying to delete a SJD. I tried this using the API that was mentioned in the doc shared by you.
This SJD was created by a code utility that was using my aad token itself for authentication and I am trying to attempt deletion using my aad token.
This is the GET call result on the same SJD
- deborshi_nag5 months agoSuper User
Hello ISHPREETKaur
Thanks for sharing the screenshots. The endpoint is not malformed, and the Ids look OK, however I am not sure how the token was generated, which could be the problem.
For deleting a SJD, your token needs the right delegated/application permissions (scopes). The SJD delete operation requires SparkJobDefinition.ReadWrite.All or Item.ReadWrite.All. Additionally, Fabric REST APIs require a Microsoft Entra token; Microsoft recommends MSAL to acquire it.Can you first check on Fabric UI if you are indeed the owner of the SJD. Click on the three dots next to your SJD, followed by View Details. If it shows you're the Owner, then it's all good!Next, use the Try It button on the REST API link below. It will authenticate you using your AAD and you don't need to supply a token. All you need to do is to supply the Workspace Id and the SJD Id in the appropriate textboxes.- ISHPREETKaur5 months agoMicrosoft Employee
Hi,
Even on the editor it is showing the same error.
And I am the admin of the workspace:
- deborshi_nag5 months agoSuper User
Hi ISHPREETKaur
Sorry to know it didn't work!
Could you try creating a SJD using Fabric UI, then deleting it using the REST API using the process above? This will rule out if anything is wrong in the creation process.