PeopleTools and Lifecycle Management - PSFT (MOSC)

MOSC Banner

Help on execute curl command in peoplecode

edited Oct 1, 2019 5:00AM in PeopleTools and Lifecycle Management - PSFT (MOSC) 10 commentsAnswered

I am trying to make a curl command call in my people code like below - this is a get API call to the vendor to get the access-token (or called bearer) back through a Oauth2 authentication scheme:

Declare Function ExecutecURLCommand PeopleCode UM_FUNCLIB_RCT.DESCR FieldFormula;

Local string &strURL = "curl -X GET  -H ""Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"" -H ""customer-id: 100000"" -H ""trading-partner: xxxxxxx"" https://sample.com/v2/oauth";

Local string &strResponse = ExecutecURLCommand(&strURL);

I have the function defined below -

Function ExecutecURLCommand(&cURLCommand) Returns string

  

   Local JavaObject &runtime = GetJavaClass("java.lang.Runtime").getRuntime();

   Local JavaObject &process = &runtime.exec(&cURLCommand);

   Local JavaObject &inputStreamReader = CreateJavaObject("java.io.InputStreamReader", &process.getInputStream());

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center