I have created the HTTP method using this post. But I'm unsure of how to test it out. Say if I run this in the Developer Console for testing how Can I link it to taking the image out of the Salesforce Dashboard and uploading it into the Document Folder so that the Image can be send upload else where?
I already have the URL to those Dashboard images that I want to upload
How do I link this to getting a image from Salesforce Dashboard and uploading it into the Document Folder?
Codes
public class testFBInt {
public void exInt() {
HttpRequest req = new HttpRequest();
req.setEndpoint('https://test.salesforce.com/services/oauth2/token');
req.setMethod('POST');
req.setBody(buildHttpQuery(new Map<String, String> {
'grant_type' => 'password',
'username' => 'username',
'password' => 'password',
'client_id' => 'Consumer_id',
'client_secret' => 'Consumer_key'
}));
}
static String buildHttpQuery(Map<String, String> queryParams) {
if (queryParams.isEmpty()) {
return '';
}
String[] params = new String[] {};
for (String k : queryParams.keySet()) {
String v = EncodingUtil.urlEncode(queryParams.get(k), 'UTF-8');
params.add(String.format('{0}={1}', new String[] { k, v }));
}
return String.join(params, '&');
}
}