API Mapping allows you to map a single JSON field to a single SObject field

For instance, if you have an SObject in your Fonteva application called Description that should map to a field in an External Application called desc, you would configure an API Mapping to ensure your data gets to the right place.

Based on this mapping, Fonteva will parse outgoing data into a JSON document based on the format the data came into Fonteva as. For example, strings will be parsed as strings, boolean will remain boolean, and so forth. This data integrity feature also works for incoming calls. JSON documents will automatically be parsed into their proper target SObject field in the format they arrive in.

You can have as many API Mappings as you want for each API Resource you create.

To Create a New API Mapping

From the API Resource Detail:

  1. [Click] .
  2. [Enter] the following information:
    • API Field - The JSON value you want to map to.
    • Target Field - The SObject field where the JSON value should go.
  3. [Click] .

Using API Mapping to Create Relationships

Additionally, you can use API Mapping to create relationships between two sObjects in your Fonteva app. 

Follow the instructions above and add a Relationship Field to create a relationship between your Target Field and the related field in the External Application.

For example, if you want to pull all the contacts from all your accounts, but only have the accountId information from the External App, you would:

  1. [Enter] the field name from the External App (e.g. accountId).
  2. [Enter] the target field in your Fonteva app (e.g. ID).
  3. [Enter] the related field to pull from the External App (e.g.: contacts).
  4. Click .

Creating Nested Objects

API Mapping can be used to create nested objects. Fonteva can look up nested data within an object. 

In your API Field, add a (.) notation to indicate nested data. 

For example:

Follow the instructions to create the API Mappings above.

Create a fourth API Mapping. Enter user.address.street as your API Field and MailingStreet as your Target Field.

The fourth API Mapping creates a User object in the data you send out to the External Application. The outgoing data array created looks like this:

{
	data : }
		{
			id : 'CONTACTED'
			primaryContact : false
			desc : 'LONG DESCRIPTION'
			user : {
				address : {
					street : '102 Main Street'
				}
			}
		}
	}
}
CODE

Fonteva does not support nested arrays.

Twitter Example: API Mapping

Here are four different code examples of API Mappings.

framework.Api.Mapping mapping = new framework.Api.Mapping();
mapping.apiResource = resource.configId;
mapping.apiObject = resource.apiObject;
mapping.apiField = 'id_str';
mapping.targetField = 'framework__Tweet_Id__c';
mapping.targetFieldType = DisplayType.String.name();
framework.Config.push(mapping);



mapping = new framework.Api.Mapping();
mapping.apiResource = resource.configId;
mapping.apiObject = resource.apiObject;
mapping.apiField = 'text';
mapping.targetField = 'framework__Tweet__c';
mapping.targetFieldType = DisplayType.String.name();
framework.Config.push(mapping);


 
mapping = new framework.Api.Mapping();
mapping.apiResource = resource.configId;
mapping.apiObject = resource.apiObject;
mapping.apiField = 'user.screen_name';
mapping.targetField = 'framework__Twitter_Handle__c';
mapping.targetFieldType = DisplayType.String.name();
framework.Config.push(mapping);


 
mapping = new framework.Api.Mapping();
mapping.apiResource = resource.configId;
mapping.apiObject = resource.apiObject;
mapping.apiField = 'created_at';
mapping.targetField = 'framework__Tweet_Date__c';
mapping.targetFieldType = DisplayType.String.name();
framework.Config.push(mapping);
CODE