I am banging my head against the wall for this one for some while now. I would appriciate some help.
Here is the RSD-file
<api:script xmlns:api="http://apiscript.com/ns?v1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- See Column Definitions to specify column behavior and use XPaths to extract column values from JSON. -->
<api:info title="data" desc="Generated schema file." xmlns:other="http://apiscript.com/ns?v1">
<!-- You can modify the name, type, and column size here. -->
<attr name="bildeLinke" xs:type="string" readonly="false" other:xPath="/json/data/bildeLinke" />
<attr name="bygning" xs:type="string" readonly="false" other:xPath="/json/data/bygning" />
<attr name="bygningsId" xs:type="string" readonly="false" other:xPath="/json/data/bygningsId" />
<attr name="del" xs:type="string" readonly="false" other:xPath="/json/data/del" />
<attr name="delSeq" xs:type="string" readonly="false" other:xPath="/json/data/delSeq" />
<attr name="dokumenterLinke" xs:type="string" readonly="false" other:xPath="/json/data/dokumenterLinke" />
<attr name="fag" xs:type="string" readonly="false" other:xPath="/json/data/fag" />
<attr name="forklaringKode" xs:type="string" readonly="false" other:xPath="/json/data/forklaringKode" />
<attr name="forvaltningsenhet" xs:type="string" readonly="false" other:xPath="/json/data/forvaltningsenhet" />
<attr name="forvaltningsenhetId" xs:type="string" readonly="false" other:xPath="/json/data/forvaltningsenhetId" />
<attr name="forvaltningsenhetTittel" xs:type="string" readonly="false" other:xPath="/json/data/forvaltningsenhetTittel" />
<attr name="kode" xs:type="string" readonly="false" other:xPath="/json/data/kode" />
<attr name="skaringFarge" xs:type="string" readonly="false" other:xPath="/json/data/skaringFarge" />
<attr name="skaringSporsmal" xs:type="string" readonly="false" other:xPath="/json/data/skaringSporsmal" />
<attr name="skaringSporsmalIkkeAktuell" xs:type="string" readonly="false" other:xPath="/json/data/skaringSporsmalIkkeAktuell" />
<attr name="skaringSporsmalKode" xs:type="string" readonly="false" other:xPath="/json/data/skaringSporsmalKode" />
<attr name="skaringSporsmalSeq" xs:type="string" readonly="false" other:xPath="/json/data/skaringSporsmalSeq" />
<attr name="skaringSvarKode" xs:type="string" readonly="false" other:xPath="/json/data/skaringSvarKode" />
<attr name="skaringSvarText" xs:type="string" readonly="false" other:xPath="/json/data/skaringSvarText" />
<attr name="spmFarge" xs:type="string" readonly="false" other:xPath="/json/data/spmFarge" />
<attr name="sporsmal" xs:type="string" readonly="false" other:xPath="/json/data/sporsmal" />
<attr name="sporsmal2" xs:type="string" readonly="false" other:xPath="/json/data/sporsmal2" />
<attr name="sporsmalFritekst" xs:type="string" readonly="false" other:xPath="/json/data/sporsmalFritekst" />
<attr name="sporsmalIkkeAktuell" xs:type="string" readonly="false" other:xPath="/json/data/sporsmalIkkeAktuell" />
<attr name="sporsmalKode" xs:type="string" readonly="false" other:xPath="/json/data/sporsmalKode" />
<attr name="sporsmalSeq" xs:type="string" readonly="false" other:xPath="/json/data/sporsmalSeq" />
<attr name="status" xs:type="string" readonly="false" other:xPath="/json/data/status" />
<attr name="svarKode" xs:type="string" readonly="false" other:xPath="/json/data/svarKode" />
<attr name="typeKartlegging" xs:type="string" readonly="false" other:xPath="/json/data/typeKartlegging" />
<attr name="typeKode" xs:type="string" readonly="false" other:xPath="/json/data/typeKode" />
</api:info>
<api:set attr="in.Header:Name#" value="Accept" />
<api:set attr="in.Header:Value#" value="application/json" />
<api:set attr="in.DataModel" value="DOCUMENT" />
<api:set attr="in.JSONPath" value="$.data" />
<api:set attr="in.EnablePaging" value="TRUE" />
<api:set attr="in.Page" value="1" />
<api:set attr="in.PageCount" value="17" />
<api:set attr="in.BaseURI" value="https://myURL.com?buildingType=BAR&page={page}" />
<api:set attr="in.ElementMapPath#" value="/json/meta/pagination/pages" />
<api:set attr="in.ElementMapName#" value="pages" />
<api:script method="GET">
<api:set attr="in.URI" value="[in.BaseURI | replace('{page}', 1)]"/>
<api:call op="jsonproviderGet" in="in" out="out">
<api:set attr="in.PageCount" value="[out.pages]"/>
</api:call>
<api:enum range="1..[in.PageCount]">
<api:set attr="in.Page" value="[_value]"/>
<api:set attr="in.URI" value="[in.BaseURI | replace('{page}', [in.Page])]"/>
<api:call op="jsonproviderGet" in="in" out="out">
<api:push item="out"/>
</api:call>
</api:enum>
</api:script>
</api:script>
Note that column is type STRING eventhough the JSON faile returns a mix of INT and STRING
When i run this in TX i get the following error eventhough all the columns are STRING
The given value of type String from the data source cannot be converted to type nvarchar of the specified target column.
String or binary data would be truncated.
Details:
String or binary data would be truncated.
Module: System.Data
System.InvalidOperationException
at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed)
The given value of type String from the data source cannot be converted to type nvarchar of the specified target column.
Module: System.Data
System.InvalidOperationException
at System.Data.SqlClient.SqlBulkCopy.ConvertValue(Object value, _SqlMetaData metadata, Boolean isNull, Boolean& isSqlType, Boolean& coercedToDataFeed)
at System.Data.SqlClient.SqlBulkCopy.ReadWriteColumnValueAsync(Int32 col)
at System.Data.SqlClient.SqlBulkCopy.CopyColumnsAsync(Int32 col, TaskCompletionSource`1 source)
at System.Data.SqlClient.SqlBulkCopy.CopyRowsAsync(Int32 rowsSoFar, Int32 totalRows, CancellationToken cts, TaskCompletionSource`1 source)
at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsyncContinued(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source)
at System.Data.SqlClient.SqlBulkCopy.CopyBatchesAsync(BulkCopySimpleResultSet internalResults, String updateBulkCommandText, CancellationToken cts, TaskCompletionSource`1 source)
at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestContinuedAsync(BulkCopySimpleResultSet internalResults, CancellationToken cts, TaskCompletionSource`1 source)
at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalRestAsync(CancellationToken cts, TaskCompletionSource`1 source)
at System.Data.SqlClient.SqlBulkCopy.WriteToServerInternalAsync(CancellationToken ctoken)
at System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServerAsync(Int32 columnCount, CancellationToken ctoken)
at System.Data.SqlClient.SqlBulkCopy.WriteToServer(IDataReader reader)
at TimeXtender.DataManager.StepTransferSSISExecute.BulkCopySource(Boolean executeIncrementalLoad, DataSource dataSource, VariableResolveObject dynamicResolveObject)
at TimeXtender.DataManager.StepTransferSSISExecute.DoStageDataSource(Boolean isIncrementalAllowed, DataSource dataSource, StepSetup stepSetup, VariableResolveObject dynamicResolveObject, Boolean loadPrimaryKeysOnTransfer)
at TimeXtender.DataManager.StepTransferSSISExecute.DoStage(StepSetup stepSetup, VariableResolveObject dynamicResolveObject)
When i use real page value in page (1,2,3 and so on) as under, there is no error and the table is populated
<api:set attr="in.BaseURI" value="myURL.com?buildingType=BAR&page=1" />
The header in POSTMAN look this:
{
"code": 200,
"meta": {
"pagination": {
"pages": 17,
"page": 2,
"limit": 5000,
"total": 83482
}
},
},
The RSD code above works fine for other Tables.