I have successfully been able to create a bulk API connection with the following code that calls the SOAP auth endpoint:
ConnectorConfig partnerConfig = new ConnectorConfig(); partnerConfig.setUsername(user); partnerConfig.setPassword(pass); partnerConfig.setProxy(proxy, port); partnerConfig.setAuthEndpoint("https://test.salesforce.com/services/Soap/u/41.0"); new PartnerConnection(partnerConfig); ConnectorConfig config = new ConnectorConfig(); config.setSessionId(partnerConfig.getSessionId()); String soapEndpoint = partnerConfig.getServiceEndpoint(); String apiVersion = "41.0"; String restEndpoint = soapEndpoint.substring(0, soapEndpoint.indexOf("Soap/")) + "async/" + apiVersion; config.setRestEndpoint(restEndpoint); config.setCompression(true); config.setTraceMessage(false); config.setProxy(host, port); BulkConnection connection = new BulkConnection(config);
After getting the BulkConnection object, I can make the necessary calls I need to manipulate data. But now I want to be able to create this object with using an access token that I receive from an Oauth call instead of authenticating with SOAP.
I'm able to retrieve the token with no issue but I'm confused as to how I can use the token afterwards to authenticate. I'm pretty sure I have to provide the token to the ConnectorConfig somehow but I can't come up with the right configuration (rest endpoint, auth endpoint, session id, etc) that's specific to oauth.
Any help will be appreciated. Thanks!