Changes the data source using a given mapping.
You can use the proposal mappings or you can declare custom mappings. For custom mappings you can change only the target id of a given mapping, but must keep all the source ids. If the target id is null, then the data source object will be removed.
POST <webiURL>/documents/{documentId}/dataproviders/mappings?originDataproviderIds={dataProviderId[,...]}&targetDatasourceId={dataSourceId}
Where:
Request body (mandatory):
<mappings> <content> . . . [mappings] </content> <parameters> . . . [parameters] </parameters> </mappings>
Response type: application/xml or application/json
Response body: see examples.
POST <webiURL>/documents/9455/dataproviders/mappings?originDataproviderIds=DP0&targetDatasourceId=11414
Request body in an XML file: there are no parameters, and all sources are mapped to a target:
<mappings> <content> <mapping> <source> <id>DS0.DO12</id> </source> <target> <id>DS1.DO12</id> </target> </mapping> <mapping> <source> <id>DS0.DO2</id> </source> <target> <id>DS1.DO2</id> </target> </mapping> <mapping> <source> <id>DS0.DO6</id> </source> <target> <id>DS1.DO39</id> </target> </mapping> </content> </mappings>
Response:
<success> <message>The resource of type 'Document' with identifier '9455' has been successfully updated.</message> <id>9455</id> </success>
POST <webiURL>/documents/9460/dataproviders/mappings?originDataproviderIds=DP0,DP1&targetDatasourceId=11414
Request body in an XML file: there are no parameters, and the last source (DS0.DO6) is not mapped to a target. It will be removed from the mapping.
<mappings> <content> <mapping> <source> <id>DS0.DO12</id> </source> <target> <id>DS1.DO12</id> </target> </mapping> <mapping> <source> <id>DS0.DO2</id> </source> <target> <id>DS1.DO2</id> </target> </mapping> <mapping> <source> <id>DS0.DO6</id> </source> <target/> </mapping> </content> </mappings>
When the document contains parameters, they will appear in the response as long as parameters are still needed (to be filled in the request body). When all the parameters have values, then the response will be successful.
POST <webiURL>/documents/9460/dataproviders/mappings?originDataproviderIds=DP0,DP1&targetDatasourceId=11414
Request body in an XML file:
<mappings> <content> <mapping> <source> <id>_Vy_yePzREeG4Q-3y4CsnNg</id> </source> <target> <id>A[Product].[Size]</id> </target> </mapping> <mapping> <source> <id>_Vy_ye_zREeG4Q-3y4CsnNg</id> </source> <target> <id>A[Employee].[Birth Date]</id> </target> </mapping> <mapping> <source> <id>_Vy_yfPzREeG4Q-3y4CsnNg</id> </source> <target> <id>A[Reseller].[Bank Name]</id> </target> </mapping> </content> </mappings>
Parameters (responses to prompts are required), so the response to this request returns the mapping information and the parameter requests:
<mappings> <content> <mapping> <source> <id>_Vy_yePzREeG4Q-3y4CsnNg</id> </source> <target> <id>A[Product].[Size]</id> </target> </mapping> <mapping> <source> <id>_Vy_ye_zREeG4Q-3y4CsnNg</id> </source> <target> <id>A[Employee].[Birth Date]</id> </target> </mapping> <mapping> <source> <id>_Vy_yfPzREeG4Q-3y4CsnNg</id> </source> <target> <id>A[Reseller].[Bank Name]</id> </target> </mapping> </content> <parameters> <parameter optional="false" type="prompt" dpId="DP1"> <id>0</id> <technicalName>psEnter Age:</technicalName> <name>Enter Age:</name> <answer constrained="false" type="Text"> <info cardinality="Single"/> </answer> </parameter> </parameters> </mappings>
Resend the request with the parameters provided:
POST <webiURL>/documents/9460/dataproviders/mappings?originDataproviderIds=DP0,DP1&targetDatasourceId=11414
Request body in an XML file:
<mappings> <content> <mapping> <source> <id>_Vy_yePzREeG4Q-3y4CsnNg</id> </source> <target> <id>A[Product].[Size]</id> </target> </mapping> <mapping> <source> <id>_Vy_ye_zREeG4Q-3y4CsnNg</id> </source> <target> <id>A[Employee].[Birth Date]</id> </target> </mapping> <mapping> <source> <id>_Vy_yfPzREeG4Q-3y4CsnNg</id> </source> <target> <id>A[Reseller].[Bank Name]</id> </target> </mapping> </content> <parameters> <parameter> <id>0</id> <answer> <values> <value id="1">25</value> </values> </answer> </parameter> </parameters </mappings>
<success> <message>The resource of type 'Document' with identifier '9460' has been successfully updated.</message> <id>9460</id> </success>