+ Start a Discussion
Jeffrey ZhangJeffrey Zhang 

spring rest help. Can't do a get.

I've successfully gotten a post login to sf and retrieved the access token.  I keep getting a 401 unauthorized error when I try to do a get though. 
public Custom [] QueryAllRules(SFDCResult sr)
		RestTemplate restTemplate = new RestTemplate();
		HttpHeaders headers = new HttpHeaders();
		headers.set("Authorization", "OAuth " + sr.getaccess_token());
		log.info("access token "+ sr.getaccess_token());
		HttpEntity<String> entity = new HttpEntity<String>(headers);
		log.info("entity header "+ entity.getHeaders());

		Custom [] gr = restTemplate.getForObject("https://vz1--REL170217.cs50.my.salesforce.com/services/data/v38.0/query?q=Select+Id+,+Name+,+Account_Access_Level__c+,+Active__c+From+Custom__c ",  GSAMRules[].class,entity);
		return gr;

I'm still learning maven/spring atm so I'm thinking I might have gotten a formatting issue somewhere? Thanks for the help!