I have a POST rest http call, where I get a file of my parameters and I am going to log in, I believe she is speaking because the route I'm setting is wrong, there is a missing bar, or the uppercase and lowercase letters .
log.info "* Login"
def sf_login_domain = grailsApplication.config.crm.sf_login_domain
log.debug "** sf_login_domain: ${sf_login_domain}"
def consumer_key = grailsApplication.config.crm.consumer_key
log.debug "** consumer_key: ${consumer_key}"
def consumer_secret = grailsApplication.config.crm.consumer_secret
log.debug "** consumer_secret: ${consumer_secret}"
def auth_username = grailsApplication.config.crm.auth_username
log.debug "** auth_username: ${auth_username}"
def auth_password = grailsApplication.config.crm.auth_password
log.debug "** auth_password: ${auth_password}"
def retornoLogin
def access_token = ""
def instance_domain = ""
//Request Access_token and instance domain for work
def http = new HTTPBuilder(sf_login_domain)
def postBody = [
grant_type: 'password',
client_id: consumer_key,
client_secret: consumer_secret,
username: auth_username,
password: auth_password
]
try {
http.post( path : 'EfetuarLogin',
body : postBody,
requestContentType: URLENC) { resp, json ->
access_token = json.access_token
instance_domain = json.instance_url + "/"
}
//INSERIR AQUI MEU log.debug "rota ${variavel com a rota}"
log.debug "** access_token: ${access_token}, instance_domain: ${instance_domain}"
coss.Parametro.executeUpdate("update Parametro p set p.valor='$access_token' where p.chave='ACCESS_TOKEN_SALES_FORCE'")
coss.Parametro.executeUpdate("update Parametro p set p.valor='$instance_domain' where p.chave='INSTANCE_DOMAIN_SALES_FORCE'")
retornoLogin = ['access_token':access_token, 'instance_domain':instance_domain]
}
catch(Exception e){
log.error "** Error code: ${e}"
log.error "** Post form: ${postBody}"
}
return retornoLogin
I know the route is set to what it contains in the variable sf_login_domain
plus my path EfetuarLogin
, to get something like http://domanin.com/EfetuarLogin
, but I do not know if that's what's being mounted in my rest , does anyone know how I can verify this?