Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Eloqua api interactions using OAuth2

User_HGTTYNov 17 2020

Hi, I am new to Eloqua and I'm totally lost. I hope this is the right place to pose this question, if not, please let me know where I should do so. My application is actually in C#, rather than JAVA and I'm trying to use Eloqua's apis.
I want to use 3 endpoints. One to get the base url, one to get the fields for a custom object and one to post to that custom object.
I am able to get to the 3 endpoints using BASIC authorization using my own user, but I want to use OAuth2 and I need to perform these calls without asking for user credentials (we are adding client information to our customObject). I.e. my application needs to have a client id and a client secret.
Does this require that we create an app to extend Eloqua? I looked at the descriptions for various types of apps and the use cases that the mention seem to be more involved. But it looks like there is no other way to use OAuth 2. Is that correct? Is it not possible to use OAuth 2.0 to get at the Eloqua's api without the app wrapper layer?
Assuming the answer to my first question is "Yes", the resource owner password credentials grant seems to be the only option I have but the OAuth 2.0 needs client ID, client secret( comes from the app) and testsite and testuser and password? What is the testsite? Does that mean that I have to create a 'fake user' for my application and use its username and password? Is creating a 'bare bones' api, installing/publishing the app instance for that user enough? Would I be able to access Eloqua's api endpoints through there? Do I need to do anything else?

Comments

Ruben Rodriguez

Hello,

I have never done this in the model, but you could try to do the same but in the DBResourceBundle.java class call AM method getResourceBundle like this:


getResourceBundle(String locale){

     String amDef = "your.fully.qualified.class.name.of.the.application.module";
     String config = "the_configuration_name_to_use";
     ApplicationModule am = Configuration.createRootApplicationModule(amDef, config);
     Map map = am.getResourceBundle(locale);
     Configuration.releaseApplicationModule(am, false);

          return map;

}

Then, in your entity.xml you should have this reference:

     <ResourceBundle>

         <JavaResourceBundle MsgBundleClass="path.to.DBResourceBundle"/>

      </ResourceBundle>

and in the attribute something like this:

     <Attribute

         Name="AttrName"

         ...>

         <Properties>

           <SchemaBasedProperties>

             <LABEL ResId="LABEL_KEY_IN_DB"/>

           </SchemaBasedProperties>

         </Properties>

      </Attribute>

regards,

Ruben

Ravi4-Oracle

Hi Ruben,

Thanks for the code. Will give it a try.

1 - 2

Post Details

Added on Nov 17 2020
0 comments
195 views