Created
April 18, 2013 03:43
-
-
Save nelsonic/5409928 to your computer and use it in GitHub Desktop.
This is what Nimil had.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Nimil Christopher | |
* @date 12 April 2013 | |
* @description This class has the Rest Callouts to publish an application to | |
* the CDN | |
*/ | |
public with sharing class HTTPHelper { | |
public static Http http; | |
public static HttpRequest httpRequest; | |
public static HttpResponse httpResponse; | |
public static boolean isApexTest = false; | |
public static String jsonList; | |
@future(callout=true) | |
public static void sendJSONListToServer(List<String> stringList){ | |
jsonList = 'json : '; | |
http = new Http(); | |
httpRequest = new HttpRequest(); | |
httpRequest.setEndpoint('http://fierce-springs-2179.herokuapp.com/upload'); | |
httpRequest.setMethod('POST'); | |
//httpRequest.setHeader('Content-Type', 'application/json'); | |
for(String eachString : stringList){ | |
jsonList += eachString + ','; | |
} | |
jsonList = jsonList.subString(0, jsonList.length() - 1); | |
httpRequest.setBody(jsonList ); | |
System.Debug('Nimil Request Body : ' + httpRequest.getBody()); | |
if(!isApexTest){ | |
httpResponse = http.send(httpRequest); | |
System.DEBUG( 'Nimil Response : ' + httpResponse.getBody()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment