Skip to Content
0

SCP Workflow - Task not found

Apr 04 at 05:52 AM

87

avatar image

Hi,

I am currently exploring the Workflow service APIs and I am testing the same using Postman. I have been trying to update the context of a particular task as shown below:

Request details:

URL: {{workflowservice}}/v1/task-instances/{{taskInstanceId}}

Method: Patch

Header: Authorization / bearer token value

Body:

{
"context": {},
"status": "COMPLETED",
"subject": "Pending at processor",
"description": "Pending at processor",
"recipientUsers": "test",
"recipientGroups": "test",
"processor": "test",
"dueDate": "2018-04-02T07:17:44.004Z",
"priority": "VERY_HIGH"
}

I am getting a 404 response code stating: bpm.workflowruntime.task.not.found. It means to say that the given "taskInstanceId" cannot be found.

However when I try to "GET" the task instance context using the same ID it returns the data successfully i.e:

{{workflowservice}}/v1/task-instances/{taskInstanceId}/context

What could be the issue here?

API | Task | patch
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Waldemar Geppart
Apr 04 at 12:00 PM
0

Hi Kavya,

my suspicion is that the placeholder {{taskInstanceId}} is not resolved correctly.
Can you try to use the task instance ID instead of the placeholder in the request URL?

Regards,
Waldemar

Share
10 |10000 characters needed characters left characters exceeded
Kavya Chilukuri Apr 04 at 12:54 PM
0

Hi Waldemar,

I did try it using the Task Instance ID directly, but it didn't work. I also simply replaced the POST method with the GET method to check whether there was any ID related issue. But GET works perfectly fine, whereas the same details fail in the POST request.

Regards,

Kavya

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Kavya,

you have to use the PATCH method on the {{workflowservice}}/v1/task-instances/{{taskInstanceId}} resource to update the task context.

Regards,
Waldemar

0

Hi Waldemar,

Yes, I am sorry, I meant PATCH (not POST as mentioned in my reply to you.)

0
Nabheet Madan Apr 13 at 07:36 AM
0

Hello Kavya

I have recently used this in my blog via PHP the API to udpate task. One is before updating anything you need to fetch XSRF token secondly use that with the PATCH method.

Thanks

Nabheet

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Nabheet,

Thanks for your reply.

I am currently using OAuth authorization to access the workflow APIs. I was trying to access the CSRF token earlier but when I wasn't getting the appropriate token in response header I raised an SAP support ticket.

This is the reply I received in the support ticket:

"with OAuth authorization, CSRF token is not needed."

When I received this information in the support ticket, I tried the workflow creation / initiation call (POST) without passing the CSRF token header, and it worked just fine

Now however when I try to use the "PATCH" method, I get the "bpm.workflowruntime.task.not.found" response.

I wonder where I am going wrong. Could you help please?

0
avatar image
Former Member Apr 17 at 04:12 AM
0

Hi,

I'm also facing the same issue. Below is the screenshot where I'm able to fetch all workflow instances.

But when I tried to change the status of the task through API call. I'm getting error code 404. Below is the screenshot of the error. Can anyone please help me here?


Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Satish,

you seem to take the Id from the workflow-instances call (i.e. have a workflow instance at hand) and feed it into the task-instances API. Workflow and task instances are not the same kind of object, so you won't find something in that way.

Regards,

Tobias

0
Former Member

Hi Tobias,

My bad, I put the workflow instance id in place of task Instance id. But even after replacing it with Task instance Id, it shows the same error.

Regards,

Satish

0
Michael Sutter
Apr 17 at 12:31 PM
0

Dear Satish,


for me it looks like you are using the Workflow instance ID (from your first call) as the Task ID in your second call.

This should be the reason for your issue, as the Task ID is another one.

One possibility in your case is to use the workflow-service/rest/v1/task-instances?workflowInstanceId= API for retrieving the task ID(s) of a workflow instance.

Regards,

Michael

Share
10 |10000 characters needed characters left characters exceeded