Salesforce Developer Apex Rest Misc


// Salesforce - Developer - REST - Expose Your Apex as a Web Service - Other:

Apex REST supports these data types for parameters and return values.

1. Apex primitives (excluding sObject and Blob).

2. sObjects

3. Lists or maps of Apex primitives or sObjects (only maps with String keys are 

4. User-defined types that contain member variables of the types listed above.

Namespaces in Apex REST Endpoints

Apex REST methods can be used in managed and unmanaged packages. When calling 
Apex REST methods that are contained in a managed package, you need to include 
the managed package namespace in the REST call URL. For example, if the class is 
contained in a managed package namespace called packageNamespace and the Apex 
REST methods use a URL mapping of /MyMethod/*, the URL used via REST to call 
these methods would be of the form

Custom Apex Web Services and Salesforce APIs

Instead of using custom Apex code for REST and SOAP services, external 
applications can integrate with Salesforce by using Salesforce’s REST and SOAP 
APIs. These APIs let you create, update, and delete records. However, the 
advantage of using Apex web services is that Apex methods can encapsulate 
complex logic. This logic is hidden from the consuming application. Also, the 
Apex class operations can be faster than making individual API calls, because 
fewer roundtrips are performed between the client and the Salesforce servers. 
With an Apex web service call, there is only one request sent, and all 
operations within the method are performed on the server.

Security Considerations for Apex Web Services

The security context under which Apex web service methods run differs from the 
security context of Salesforce APIs. Unlike Salesforce APIs, Apex web service 
methods run with system privileges and don’t respect the user’s object and field 
permissions. However, Apex web service methods enforce sharing rules when 
declared with the with sharing keyword.

PageReference pageRef = new PageReference('***partialURL***');
PageReference pageRef = new PageReference('***fullURL***');
PageReference pageRef = new PageReference('');
PageReference pageRef = ApexPages.currentPage();
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License