cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Workflow from Appgyver

former_member1974
Participant

Hello experts,

I am calling workflow instance from Appgyver. I am getting bearer token and I am passing further to HTTP request (component installed from market)

I am passing URL : https://api.workflow-sap.cfapps.eu10.hana.ondemand.com/workflow-service/rest/v1/workflow-instances

And Header part passing as: accessToken is "Bearer <token ID>" I am getting it from previous HTTP request (GET)

Request Body I am preparing as JSON with definitionID and context.

When I execute it, I am getting below error:

 Full authentication is required to access this resource

Please guide me further, If I missing anything.

Thanks,

PD

Accepted Solutions (0)

Answers (6)

Answers (6)

former_member1974
Participant

Hi, I get below error when I tried updating instance

jannes_schofeld
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi abhimohpra17 ,

what does the JSON of your workflow service instance parameters currently look like? When you are in your SAP BTP Cockpit, select Services -> Instances and Subscriptions and then select View Parameters for your workflow service instance, as shown in the attached screenshot. Use that JSON, add the missing scope and update your instance. You do not need the same parameters that I posted as an example in my previous answer. You need to adjust your existing service instance parameters.

Best regards,

Jannes

jannes_schofeld
Product and Topic Expert
Product and Topic Expert

Hi abhimohpra17 ,

are you using your individual user to obtain the JWT token, or the Workflow service instance? Your user requires the role WorkflowInitiator, the service instance requires the scope WORKFLOW_INSTANCE_START.

Did you consider this? If you want to adjust the scopes of your workflow service instance, in the BTP cockpit find the instance and select View Parameters. This should give you a JSON like the following:

{
    "applicationScope": "com.sap.workflowmanagement",
    "authorities": [
        "WORKFLOW_INSTANCE_CANCEL",
        "WORKFLOW_INSTANCE_GET",
        "WORKFLOW_DEFINITION_GET_MODEL",
        "WORKFLOW_INSTANCE_GET_CONTEXT",
        "PROCESS_VARIANT_ACTIVATE",
        "PROCESS_VARIANT_DELETE",
        "FORM_DEFINITION_GET",
        "FORM_DEFINITION_UNDEPLOY",
        "WORKFLOW_DEFINITION_UNDEPLOY",
        "WORKFLOW_INSTANCE_START",
        "WORKFLOW_INSTANCES_UPDATE",
        "WORKFLOW_INSTANCE_RETRY_RESUME",
        "WORKFLOW_DEFINITION_GET_SAMPLE_CONTEXT",
        "PROCESS_VARIANT_GET",
        "WORKFLOW_INSTANCE_SUSPEND",
        "MESSAGE_SEND",
        "WORKFLOW_DEFINITION_GET"
    ],
    "dataVisibility": "shared",
    "defaultCollectionQueryFilter": "shared"
}

In the authorities array, check if the required scope is there. If not, copy the whole JSON, and for your workflow service instance select the Update option. In the Parameters, paste the JSON and add the missing scopes in the authorities array.

Best regards,

Jannes

former_member1974
Participant
0 Kudos

Thanks. I will check the links. I am already triggering successfully from SAP iRPA successfully.

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

Did you resolve this issue?

former_member1974
Participant
0 Kudos

No could not solve the issue

former_member1974
Participant
0 Kudos

jannes.s still could not solve the issue. Is it becaue I am not using AppGyver on BTP and directly from Composer Pro and my workflow service instance is created in the BTP tenant?

jannes_schofeld
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi abhimohpra17,

I don't think that is the issue. Have you been able to start the workflow manually using a REST client (e.g. Postman or REST Client in SAP Business Application Studio? In that case, you can also check the scopes in your JWT token and see, if they contain the required scope for starting workflows. Have a look at my blog post regarding that topic.

In case you are able to start a workflow via REST client, the issue must be in your AppGyver app. Are you able to check the token that you retrieve within your app? Have you checked this blog post by manuel.namyslo, where he integrates SAP AppGyver and SAP Workflow Management?

Best regards,

Jannes

former_member1974
Participant
0 Kudos

jannes.s Looks like problem is this parameter.

"applicationScope": "com.sap.workflowmanagement"

I will update further details here.

former_member1974
Participant
0 Kudos

jannes.s

Thanks for your reply. I am using workflow instance to generate the token. I will try to update the instance and update it here.