Skip to content

Instantly share code, notes, and snippets.

@Patlatus
Created September 11, 2018 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Patlatus/296a26496abf1bfa78f452afc823ed50 to your computer and use it in GitHub Desktop.
Save Patlatus/296a26496abf1bfa78f452afc823ed50 to your computer and use it in GitHub Desktop.
URLService
<!-- <pre>
public class URLService {
@auraEnabled
public static String getBaseURL() {
PageReference pr = new PageReference('/id/' + UserInfo.getOrganizationId() + '/' + UserInfo.getUserId() + '?oauth_token=' + UserInfo.getSessionId() );
System.debug(LoggingLevel.ERROR, '@@@ v: ' + pr.getContent().toString() );
String data = pr.getContent().toString();
Map result = (Map)Json.deserializeUntyped(data);
Map urls = (Map)result.get('urls');
System.debug(LoggingLevel.ERROR, '@@@ v: ' + (String)urls.get('rest') );
String rest = (String)urls.get('rest');
String[] items = rest.split('/');
return items[0] + '//' + items[2] + '/';
}
}
</pre> -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment