Hi Jason, check out these resources:
In short, this will take you through the topics of setting up a REST Data source and consuming it via ModScript.
Thank you for your reply, I saw those examples earlier. I tried to follow the along with the example but doesn't make sense. SBM Modscript examples for reset callouts seems like missing the sample application.
I am new to modscript and these documentation are not very clear. I would like to see more simple examples for GET, POST, PUT, DELETE for rest API to other applications.
Can you clarify your intended use cases? The example (https://docs.microfocus.com/doc/Solutions_Business_Manager/12.0/modscript_samplerestdatasource) basically shows how to consume a REST Data source to read items from SBM using the REST/JSON API call GetItemsByListingReport.
It assumes that the Data source has already been defined in Composer (and in this case is named "AE")
https://docs.microfocus.com/doc/Solutions_Business_Manager/12.0/modscript_restdatasource shows the supported object methods and http methods (namely GET and POST, not PUT nor DELETE).
This example (https://community.microfocus.com/it_ops_mgt/sbm/w/sbm_tips/3577/sbm-modscript-part-8---rest-callouts) is more advanced, but still doesn't get you to a point of using additional HTTP methods.
Thanks for your response, I'll look at those examples.
Orchestrations is something I looked at and ran into a issue. I tried setting up endpoint in repository to get the access token using OAuth2 Authentication but that will not work since it does not have all the required fields I need to make the request. The external app API requires body text to be sent when requesting token. Which consist of username/password, client_secret, and client_id, and grant_type.
I was able to get the token access using orchestrations by creating a post request then getting the token back and then creating another service post step to create ticket into the external app API. This seems to fail at sending the correct headers with token. I do have the debugging on and seems like JSON data its passing is formatted correctly by pasting same data into postman.
Following is the required headers:
("Authorization", "Bearer " + token)
Any suggestions ?
Hi Jason, Your questions are starting to get deeper than I can easily support via the forum.
This section of the help discusses the RESTCaller: https://docs.microfocus.com/doc/Solutions_Business_Manager/12.0/ttst_restcaller_chapter
This portion of the help talks about the options for building the request body and passing headers: https://docs.microfocus.com/doc/Solutions_Business_Manager/12.0/ttst_restcaller_arguments
The process of authenticating that you described resembles how you would authenticate to SBM's RESTful services as well. This can be achieved via an orchestration: https://docs.microfocus.com/doc/Solutions_Business_Manager/12.0/json_api_requesting_security_token
I do not have first hand experience with OAuth2 and the RESTCaller. However, this page may help: https://docs.microfocus.com/doc/Solutions_Business_Manager/12.0/ar_configuring_oauth_security
In general, try to let the endpoint definition do as much of the heavy lifting as possible.
I work in Micro Focus Professional Services. If you think you would like some dedicated assistance from our team, let me know and we can schedule a call to help scope the effort and provide a quote.