An API Resource is a custom setting used for mapping an Endpoint to an SObject. This custom setting also stores the fields and Endpoints for the data you're pulling from the External Application. You can create an unlimited amount of API Resources for each of your API Services.

For example, if you have an SObject in your Fonteva application called Contacts and you need that data to go to a field in an External Application called Contact ID, you would use an API Resource to ensure the data gets to the right place in the External Application.

Setting up a New API Resource

From the API Service Detail:

  1. [Click] 
  2. A modal displays. [Enter] the following information:
    • API Resource Name
    • Target SObject - The target SObject for the information requested from the External Application.
    • Target SObject Key Field - This is the identifying field that will uniquely identify it in the External Application.
    • API Object - The object in the JSON document the API Resource is looking for.
    • API Object Key Field - The external identifier that uniquely identifies that record in the External Application.
  3. [Click] the select box to disable POST/PUT JSON Parse.
  4. [Click]

For each API Resource, you can specify custom URIs to perform specific operations within that API Resource. There is no need to enter the full URL, as Fonteva attaches each URI to the URL specified in the parent API Service. You can specify the particular URI Verb for each action within the API Resource.

There are 4 different operations to choose from:

  • Create - Creating a new record.
  • Read - Reading a record.
  • Update - Changing an existing record.
  • Delete - Deleting an existing record.

On the URI Mapping tab:

  1. [Enter] the URI for each operation you would like to map
  2. Choose the URIVerb from the menu. Available choices are:
    • GET
    • POST
    • PUT
    • DELETE
  3. [Click] 

Once the API Resource is created, it automatically becomes a RESTful Endpoint in Salesforce. If you want this endpoint available for incoming calls, it must follow Salesforce's Authentication Model. See Understanding Authentication for more information.

Incoming Calls and API Resources

  • Once the API Resource is created, it automatically becomes a RESTful Endpoint in Salesforce.
  • You can add a q parameter to filter information pulled from that endpoint. This parameter becomes a SOQL 'Where' clause.
  • If you want this endpoint available for incoming calls, it must follow Salesforce's Authentication Model. See Understanding Authentication for more information.


Additional Configuration

Fonteva caches all previous JSON responses from the API calls your app makes. Configuring these methods allow you to easily access this data.

getPreviousJSONResponse -  this method allows you to pull a specific JSON response from that cached list. You provide the specific API Resource, the HTPP verb and the position of the JSON in the list, and the mapped JSON is returned.

getLastJSONResponse - this method pulls the last mapped JSON response received. You provide the specific API Resource name and the appropriate HTTP verb.

getLastRawReasponse - this method pulls the last JSON data received without the mapping. You provide the API Resource name and appropriate HTTP verb.

These methods are not available for configuration in the UI. Contact Fonteva for more information.


Twitter Scenario: API Resource and URI Mapping

For the Twitter Scenario, you only need to read tweets. You only need to enter information for the Read URI and choose the Read URI verb.

framework.Api.Resource resource = new framework.Api.Resource();
resource.apiService =;
resource.configId = 'Hashtags';
resource.apiObject = 'statuses';
resource.targetSObject = 'framework__Twitter_Tweet__c';
resource.apiObjectKeyField = 'id_str';
resource.targetObjectKeyField = 'framework__Tweet_Id__c';
resource.readURI = '/1.1/search/tweets.json';
resource.readVerb = 'GET';