Difference between revisions of "REST API:import Mapping Profile Resource"
From AgileApps Support Wiki
imported>Aeric |
imported>Aeric m (Text replace - '{domain}' to '{{domain}}') |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Manage import [[Mapping Profile]] | Manage import [[Manage_Data_Import#Mapping Profile|Mapping Profiles]] using the [[REST API]]. | ||
''Learn more:'' | ''Learn more:'' | ||
Line 6: | Line 6: | ||
===Permissions=== | ===Permissions=== | ||
{{permissions| | {{permissions|Use Development Features|use this resource.}} | ||
===List Import Field-Mapping Profiles=== | ===List Import Field-Mapping Profiles=== | ||
Line 12: | Line 12: | ||
;Method:GET | ;Method:GET | ||
;URI:<tt><nowiki>https://{domain}/networking/rest/import/{objectName}</nowiki></tt> | ;URI:<tt><nowiki>https://{{domain}}/networking/rest/import/mappingProfile/{objectName}</nowiki></tt> | ||
;Response: | ;Response: | ||
Line 65: | Line 65: | ||
;Method:GET | ;Method:GET | ||
;URI:<tt><nowiki>https://{domain}/networking/rest/import/{objectName}/{mapping_profile_name}</nowiki></tt> | ;URI:<tt><nowiki>https://{{domain}}/networking/rest/import/mappingProfile/{objectName}/{mapping_profile_name}</nowiki></tt> | ||
;Response: | ;Response: | ||
Line 114: | Line 114: | ||
;Method:POST | ;Method:POST | ||
;URI:<tt><nowiki>https://{domain}/networking/rest/import/{objectName}</nowiki></tt> | ;URI:<tt><nowiki>https://{{domain}}/networking/rest/import/mappingProfile/{objectName}</nowiki></tt> | ||
;Request: | ;Request: | ||
Line 156: | Line 156: | ||
;Method:PUT | ;Method:PUT | ||
;URI:<tt><nowiki>https://{domain}/networking/rest/import/{objectName}/{mapping_profile_name}</nowiki></tt> | ;URI:<tt><nowiki>https://{{domain}}/networking/rest/import/mappingProfile/{objectName}/{mapping_profile_name}</nowiki></tt> | ||
;Request: | ;Request: | ||
Line 198: | Line 198: | ||
;Method:DELETE | ;Method:DELETE | ||
;URI:<tt><nowiki>https://{domain}/networking/rest/import/{objectName}/{mapping_profile_name}</nowiki></tt> | ;URI:<tt><nowiki>https://{{domain}}/networking/rest/import/mappingProfile/{objectName}/{mapping_profile_name}</nowiki></tt> | ||
:Record ID of the mapping profile can also be specified. | :Record ID of the mapping profile can also be specified. | ||
Line 212: | Line 212: | ||
:See also: [[REST API:Error Codes]] | :See also: [[REST API:Error Codes]] | ||
===Fields=== | ===Fields=== |
Latest revision as of 19:19, 25 April 2014
Manage import Mapping Profiles using the REST API.
Learn more:
- bulk import Resource for importing data
- REST API Conventions and Considerations.
Permissions
Users that have the Use Development Features permission can use this resource.
List Import Field-Mapping Profiles
- Method
- GET
- URI
- https://{{domain}}/networking/rest/import/mappingProfile/{objectName}
- Response
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<mappingProfile> <id>1351233928</id> <name>TestMap</name> <description/> <objectId>e8dc7a31353947729c2d1995e3185771</objectId> <date_created>2012-03-14T04:59:39.000Z</date_created> <date_modified>2012-03-14T20:51:37.000Z</date_modified> <modified_id type="" uri="https://.." displayValue="John Doe">1424089492</modified_id> <created_id type="" uri="https://localhost/networking/rest/USER/1424089492" displayValue="John Doe">1424089492</created_id> <mapping> <energy csvColumnName="Energy (kWh)">2</lk> <numberField csvColumnName="Number">1</numberField> </mapping> <advancedOptions> <mergeOptions>MERGE_USING_PRIMARY_KEY</mergeOptions> <recordOwner type="" uri="https://..." displayValue="John Doe">1424089492</recordOwner> <lookupFieldOptions> <lookupFieldOption lookupColumnName="Lk">time_field</lookupFieldOption> </lookupFieldOptions> </advancedOptions> </mappingProfile>
<mappingProfile> ... </mappingProfile> ...
<message>
0
<description>Success</description>
</message>
<recordCount>N</recordCount>
</platform> </syntaxhighlight>
- See also: REST API:Error Codes
Get an Import Field Mapping Profile
- Method
- GET
- URI
- https://{{domain}}/networking/rest/import/mappingProfile/{objectName}/{mapping_profile_name}
- Response
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<mappingProfile> <id>1351233928</id> <name>TestMap</name> <description/> <objectId>e8dc7a31353947729c2d1995e3185771</objectId> <date_created>2012-03-14T04:59:39.000Z</date_created> <date_modified>2012-03-14T20:51:37.000Z</date_modified> <modified_id type="" uri="https://..." displayValue="John Doe">1424089492</modified_id> <created_id type="" uri="https://localhost/networking/rest/USER/1424089492" displayValue="John Doe">1424089492</created_id> <mapping> <energy csvColumnName="Energy (kWh)">2</lk> <numberField csvColumnName="Number">1</numberField> </mapping> <advancedOptions> <mergeOptions>MERGE_USING_PRIMARY_KEY</mergeOptions> <recordOwner type="" uri="https://localhost/networking/rest/USER/1424089492" displayValue="John Doe">1424089492</recordOwner> <lookupFieldOptions> <lookupFieldOption lookupColumnName="Lk">time_field</lookupFieldOption> </lookupFieldOptions> </advancedOptions> </mappingProfile>
<message>
0
<description>Success</description>
</message>
</platform> </syntaxhighlight>
- See also: REST API:Error Codes
Add an Import Field-Mapping Profile
- Method
- POST
- URI
- https://{{domain}}/networking/rest/import/mappingProfile/{objectName}
- Request
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<mappingProfile> <name>TestMap</name> <description/> <mapping> <energy csvColumnName="Energy (kWh)">2</lk> <numberField csvColumnName="Number">1</numberField> </mapping> <advancedOptions> <mergeOptions>MERGE_USING_PRIMARY_KEY</mergeOptions> <recordOwner type="" uri="https://..." displayValue="Justin Thyme">764db24986</recordOwner> <lookupFieldOptions> <lookupFieldOption lookupColumnName="Lk">time_field</lookupFieldOption> </lookupFieldOptions> </advancedOptions> </mappingProfile>
</platform> </syntaxhighlight>
- Response
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<message>
0
<description>Success</description>
<id>...</id>
</message>
</platform> </syntaxhighlight>
- See also: REST API:Error Codes
Update an Import Field-Mapping Profile
- Method
- PUT
- URI
- https://{{domain}}/networking/rest/import/mappingProfile/{objectName}/{mapping_profile_name}
- Request
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<mappingProfile> <name>TestMap</name> <description/> <mapping> <energy csvColumnName="Energy (kWh)">2</lk> <numberField csvColumnName="Number">1</numberField> </mapping> <advancedOptions> <mergeOptions>MERGE_USING_PRIMARY_KEY</mergeOptions> <recordOwner type="" uri="https://..." displayValue="Justin Thyme">764db24986</recordOwner> <lookupFieldOptions> <lookupFieldOption lookupColumnName="Lk">time_field</lookupFieldOption> </lookupFieldOptions> </advancedOptions> </mappingProfile>
</platform> </syntaxhighlight>
- Response
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<message>
0
<description>Success</description>
</message>
</platform> </syntaxhighlight>
- See also: REST API:Error Codes
Delete an Import Field Mapping Profile
- Method
- DELETE
- URI
- https://{{domain}}/networking/rest/import/mappingProfile/{objectName}/{mapping_profile_name}
- Record ID of the mapping profile can also be specified.
- Response
- <syntaxhighlight lang="xml" enclose="div">
<platform>
<message>
0
<description>Success</description>
</message>
</platform> </syntaxhighlight>
- See also: REST API:Error Codes
Fields
- Note: Unless otherwise indicated, the attribute for a field is "Editable on Add or Update".
Name Type Attribute Required on Add/Update Description Additional Information id String Read Only Record Id name String Mapping profile name description String mapping Tag Describes the mapping betweeen the CSV columns and Platform fields. advancedOptions Tag Defines additional mapping profile options date_modified Date Read Only UTC Format date_created Date Read Only UTC Format created_id Lookup Read Only User ID modified_id Lookup Read Only User ID
mapping Tag
Name Type Required on Add/Update Description Additional Information platform field Number CSV column number The tag name is the name of an object field. The number is the CSV data column it maps to. The first column is column "zero". So <phone>1</phone> maps the second CSV column to the phone field. csvColumnName Attribute CSV-column identifier The value of this attribute is displayed in the GUI to help a user map the intended columns.
Learn more: Data Import Wizard
advancedOptions Tag
Name Type Required on Add Description Additional Information mergeOptions String Possible values: - DO_NOT_MERGE
- MERGE_USING_PRIMARY_KEY
- MERGE_USING_RECORD_ID
MERGE_USING_RECORD_ID works only if the record_id field is mapped. recordOwner Lookup Default record owner A User ID.
Learn more: Data OwnershiplookupFieldOptions Tag One or more option tags governing lookup fields
lookupFieldOptions Tag
Name Type Required on Add Description Additional Information lookupFieldOption String Possible values - MATCH_BY_LOOKUP_ID
- MATCH_BY_LOOKUP_RECORD_LOCATOR
- field name
When a field name is specified, data in the CSV column is matched against that field in the Lookup target object. lookupColumnTitle Attribute The name of the Lookup field in the platform object.
Note:
When defining a profile mapping, these are the field names to use for the standard fields defined for custom objects:- row_id - Record Id
- OWNER - Record owner's name
- OWNER_ID - Record owner's User ID
Error Codes
Platform Code Error -52 INVALID_MAPPING_PROFILE_NAME -53 PLEASE_PROVIDE_ADVANCED_MAPPING_OPTIONS -54 INVALID_DEFAULT_OWNER_ID_SELECTED -55 INVALID_MERGE_OPTION_FOR_ACCOUNTS -56 INVALID_PROPSECT_OWNER_ASSIGNMENT_OPTION -57 FIELD_IN_MAPPED_COLUMNS_DOES_NOT_EXIST -58 INVALID_CSV_COLUMN_NUMBER
Learn more:
- See the REST API:Error Codes for common Http error codes
- See the javadoc constants for a complete list of PlatformException error-code constants.