You need to sign in to do that
Don't have an account?
connection between salesforce to external system
Hi All,
For the first time i am doing integration. Im having a consumer key and secret key of external system.Now I want to do initial connection between salesforce to external system using REST API, how to acheive this. Kindly give me any links and sample programs. I have seen the rest api documentation but i dont get any idea. Thanks in advance
Please guide me am i doing right or wrong.i write a apex class and vf page but i getting this error
Assertion Failed: System.HttpResponse[Status=Found, StatusCode=302]
public class xeroController {
public String Headers {get; set;}
public String Response {get; set;}
public void doRequest() {
String data = '{'
+ '\n' + '"website":"https://api.xero.com/api.xro/2.0/",'
+ '\n' + '"segment":['
+ '\n' + ' {'
+ '\n' + ' "did":{'
+ '\n' + ' "operator":"AND",'
+ '\n' + ' "filters":['
+ '\n' + ' {'
+ '\n' + ' "scope":"actions",'
+ '\n' + ' "key":"name",'
+ '\n' + ' "match":"match",'
+ '\n' + ' "value":"quote"'
+ '\n' + ' }'
+ '\n' + ' ]'
+ '\n' + ' },'
+ '\n' + ' "are":{'
+ '\n' + ' "operator":"AND",'
+ '\n' + ' "filters":[]'
+ '\n' + ' }'
+ '\n' + ' }'
+ '\n' + '],'
+ '\n' + '"offset":0,'
+ '\n' + '"report_id":-1' +
'}';
System.HttpRequest request = new System.HttpRequest();
request.setBody(data);
request.setMethod('POST');
request.setEndpoint('https://api.xero.com/api.xro/2.0/');
request.setHeader('X-Api-Version', '2.0');
request.setHeader('X-Access-Id', 'UEOJMV6KBZKSD7VAWKHYLZ64TZSS9I ');
request.setHeader('X-Access-Secret', 'T6PVV8JMI3LV776V922OW3TR8OGY5L');
System.HttpResponse response = new System.Http().send(request);
System.assert(false, response); //remove this once you fix the 403
this.Response = response.getBody();
}
}
VF Page:
<apex:page controller="xeroController" action="{!doRequest}" contentType="text/plain"> {!Headers} {!Response} </apex:page>