Product Information
SAP Process Automation: How to test the API trigger with postman
In my last blog post I explained how to design a process with an API based trigger. Many of you are curious about how you can test this new feature.
I will describe the technical implementation and the testing procedure in this blog post.
Technical prerequisite
To use the API trigger you need a service instance with a service key in your sub-account where you are using SAP Process Automation.
Service instance
In your subaccount a service instance should be already exist. You can find the service instance in the Instances and Subscriptions section.
If you have no service instance please create a service instance by following the guided procedure after the click on the Create button.
Service key
If you have already the service instance or just created it, check if you have also created a service key.
If not please create a service key using the icon with three dots.
Using Postman
All information to call the API trigger are available in the service key. Therefor open the service key and use the following information:
- endpoints api url
- clientid
- clientsecret
- uaa url
Create a new post request in postman with the endpoints api url and add /workflow/rest/v1/workflow-instances to the url.
To get a token select Client Credentials as Grant Type, use the uaa url plus /oauth/token for the Access Token URL and fill in Client ID and the Client Secret.
For the Client Authentication use “Send as Basic Auth header”.
After maintaining the data click on Get New Access Token and use the token.
After this you switch to the Body tab and maintain the payload.
You can find the definition ID in the Monitoring section of SAP Process Automation. Go there to Manage and then to Processes and Workflows.
Copy the ID and paste the value into the payload. In the “context” of your payload you have to maintain all the fields you need.
Now you can execute the post request and you successfully create your first process instance via the API trigger.
Conclusion
You learned now how to test the API trigger in SAP Process Automation and you can start now integrate processes designed in SAP Process Automation in your applications.
Next Steps
You are curious now but do not how to start? Try it out now using our Free Tier offering.
You are interested in the bigger picture of LCNC?
To see LCNC in action, check out the SAP Low-Code/No-Code Learning Journey – designed to increase low-code/no-code skills and teach citizen developers the basic concepts of software development including SAP AppGyver, SAP Process Automation, and SAP Work Zone and learn how to build mobile apps for free. Check out LCNC and plus much more free learning for developers at SAP Learning site.
For more information on SAP Process Automation, please refer to the following sources:
- Exchange knowledge: SAP Community | Q&A| Blogs
- Explore: SAP Product Page | Product Demo
- Learn more: SAP Help Portal | SAP Learning Journey
- Follow us on LinkedIn, Twitter, and YouTube
In case anyone is interested in a Postman collection and environment that can help you get started.... see the examples below. The collection includes OAuth 2.0 authentication. All you will need to update is the Postman environment details.
sample.postman_collection.json
sample.postman_environment.json
Great Blog Peter Engel . Thank you Antonio Maradiaga for thoughtfully sharing the postman collections
Hello, is it possible to use a service instance of the service "ABAP environment" or any other environment, or is it only possible to generate a valid service key with a service instance of the type "SAP Process Automation"?
I'm asking this because I only have an Instance of the type "ABAP environment" installed on my subaccount and when I try to set up one for Process Automation, it won't let me, for the reason that I am subscribed to it already.
Hi Nils,
you ned a process instance for SAP Process Automation. If you cannot create a service instance go to the entitlement section in menu -> configure entitlements -> add service plans. Search for SAP Process Automation and add the plan "standard" to your sub-account and save the new settings. Now you are able to add the service instance This plan is without any charges.
Sorry for the inconvenience.
Br,
Peter
Hi Peter,
Free tier SPA doesn't allow us to trigger automation via API from external.
Only SPA with standard edition can, it's also shown in your screenshot.
Any chance to lift the limitation?
Thanks.
Regards,
Nick
Hi Nick,
you ned a process instance for SAP Process Automation. If you cannot create a service instance go to the entitlement section in menu -> configure entitlements -> add service plans. Search for SAP Process Automation and add the plan "standard" to your sub-account and save the new settings. Now you are able to add the service instance This plan is without any charges.
Sorry for the inconvenience.
Br,
Peter
Peter Engel Very informative blog.
I tried to execute API trigger with SAP Build Process Automation. The Trigger has worked and showing "Running Status"
In my workflow I have created a form which shows only information of received payload. However, I have not received anything in the inbox which displays this information.
Hi Nilesh,
so you see no task in your inbox even not an empty one?
Do you see the created task in the log?
Br,
Peter
Peter Engel I don't see any task in my inbox. However, under Manage->Processes and workflow, definition ID is generated (which i have used it in postman payload)
Under Trigger option -> I can see trigger entry
My workflow is simple, I am receiving payload and displaying it on the form fields.
Am I missing any step?
Hello,
I tried using the APIHUB but my token expired, does the token created with Postman expire too?
Hi,
yes the token created with postman will expire too.
Br,
Peter
Hello, thanks for your blog!
I'm testing a process that starts with an API trigger.
I was able to run it from API Business Hub, using the tutorial (Create an API Trigger for the Process | Tutorials for SAP Developers)
Then I tried to run it with Postman, I managed to pass the authorization and get the token using your blog, but then it asks for the CSRF token.
I tried to get it with a GET method asking for the token in the header with a "fetch" value, but it didn't work.
Am I doing something wrong?
Bohdan Kuzmenko
The same credentials which you have used in API Business hub should work in POSTMAN.
Only an Authorization token is required.
Can you please share the screenshot which throws an error to add the CSRF token?
Sure, here are the screenshots:
After getting the token with authorization it generated the key and added it to "Params" section
I've created the request from scratch and somehow it worked for me, now it didn't create anything at the "Params" tab and automatically added Bearer token into Headers
Hi Bohdan Kuzmenko
When you create an authorization token, it would automatically be added to the Header parameters.
Did you add the body of the call as mentioned in the blog post?
Can we connect offline to solve your issue?
Yes, I've added the body, maybe I did something else wrong before, but now everything is fine.
Not sure that there is a possibility of an offline meeting for now, but we could make an online call, if you would like me to show you the request live.
Hi Peter,
Thanks for the useful blog, I have test the process and created a very simple automation just about open excel instance and log a value. The steps worked well and in the monitor it shows the status of rpa was started and running but there's nothing happened.
Could you give me some advice if there's any steps I missed?
Hi,
did you installed the Agent and the browser extension correctly? Is the Agent connected and registered in the settings? Does the Agent version fits to the settings of the project? Is the Agent in unattended mode?
For more information check our developer tutorials.
Br,
Peter
Thanks for the reply.
I just check the agent and change the mode to unattended and it works.
Have a nice day!
Hey Peter,
Great blog as always, I'm wondering if we can pass any data during the API trigger?
For example some data will be pass through the API and the data will shown in a form.
Thanks,
Ashraff
Hi Ashraff,
of course you can pass data through the API trigger. The payload is a json structure where you can use predefined data types or your own data types as well as lists.
Br,
Peter
Hi Peter,
That sounds awesome! Thanks for sharing.
Ashraff