Company is using SharePoint Server 2013 and i'm trying to write a service for another application which people can track workflow status.
What i try is getting Workflow Instance ID with;
/_api/web/lists/GetByTitle('Library Name')/Items(5)?$select=WorkflowInstanceID and there is no select for list item like $select=WorkflowAssociations. And there is no $expand='workflowname' option. Because workflow is not expandable.
but WorkflowInstanceID always returns null, even i got attached multiple workflows and all of them started and completed.
My main goal is creating URL like /_layouts/15/WrkStat.aspx?List={ListGuid}&WorkflowInstanceID={WorkflowInstanceGuid} so when people click this link, they can track the workflow steps.
I've also tried to use Tasks list with /_api/web/lists/getbytitle('Tasks')/Items, but this list also doesn't return Task's associated list item's GUID or WorkflowInstanceID
A SharePoint list should contain an hyperlink field with your workflow name. This field can be used to get the full URL to the workflow instance.
The above API endpoint will return all columns including workflow field with the URL value.
Try this and let me know if it works for you.