Glad you showed us everything you tried. You are really close, man!
go to Setup > Remote Site Settings and create an entry for http://www.woopra.com/
create the following Visualforce Page and Apex Class, then view the page at /apex/Woopra
see if you get a 403 like I do ;-) then substitute your real credentials into the request headers
play until it gives you 200 OK, then remove the System.assert...
(that was for debug)
eyeball the response data, and how you might go about parsing / displaying it...
Don't forget to update us!
Here's how you might do your API call in Apex - try:
WoopraController.cls
public class WoopraController {
public String Headers {get; set;}
public String Response {get; set;}
public void doRequest() {
String data = '{'
+ '\n' + '"website":"yourwebsite",'
+ '\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('http://www.woopra.com/rest/search');
request.setHeader('X-Api-Version', '2.0');
request.setHeader('X-Access-Id', 'APP_IDXXXXXXXX');
request.setHeader('X-Access-Secret', 'SECRET_KEYXXXXXXX');
System.HttpResponse response = new System.Http().send(request);
System.assert(false, response); //remove this once you fix the 403
this.Response = response.getBody();
}
}
Woopra.page
<apex:page controller="WoopraController" action="{!doRequest}" contentType="text/plain">
{!Headers}
{!Response}
</apex:page>
Best Answer
Can use DocuSiggn soap API to create the email attachment and to track it, can use the docusign app.Refer Attaching a visualforce page rendered as PDF to Docusign email for the complete answer explained.