owainlewis/salesforce

Execution error (MalformedURLException) at java.net.URL/<init>

wimvelzeboer opened this issue · 1 comments

Hi
While trying to setup a connection with Salesforce I ran into the following issue:

Execution error (MalformedURLException) at java.net.URL/ (URL.java:672).
no protocol: /services/data/v51.0/sobjects/Account

This is code that I used, and I got a warning and exception while loading it into the REPL

Connecting to local nREPL server...
nREPL server started on port 56447 on host localhost - nrepl://localhost:56447
Clojure 1.10.1
(ns mytest.core )
=> nil
(use 'salesforce.core)
WARNING: update already refers to: #'clojure.core/update in namespace: clj-http.client, being replaced by: #'clj-http.client/update
=> nil
(def config
  {:client-id "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
   :client-secret "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
   :username "xxxxxx@xxx.com"
   :password "XXXXX"
   :security-token ""  
   :login-host "test.salesforce.com"})
=> #'mytest.core/config

(def auth-info (auth! config))
Execution error (ExceptionInfo) at slingshot.support/stack-trace (support.clj:194).
clj-http: status 400

(set-version! (latest-version))
=> "51.0"

(defn foo
  "I don't do a whole lot."
  []
  (println "My First Salesforce connection!")
  (so->all "Account" auth-info))
=> #'mytest.core/foo

(foo)
My First Salesforce connection!
Execution error (MalformedURLException) at java.net.URL/<init> (URL.java:672).
no protocol: /services/data/v51.0/sobjects/Account

Any thoughts on how I can resolve this?

Ah, I seem to have found the issue.
I read in the documentation that you can:

"...optionally pass in :login-host if you want to use test.salesforce.com or my.salesforce.com addresses"

So, I added the :login-host to the config map, but after some digging through the source code it seems that you have to use
:sandbox? :IS_SANDBOX instead.

That's correct right?
Should the README.md file then be updated or is this something that should be added to the source code?