Wiki source code of Download a project (export)

Last modified by Nico Lemaire on 2025/09/01 13:36

Show last authors
1 (% class="jumbotron" %)
2 (((
3 (% class="container" %)
4 (((
5 To connect with the TerraIndex database to retreive projects from or upload new projects, you can connect to a webservice. This webservice provides Exports and enables these export with changes to be uploaded again.
6
7 There are two steps to consider, it’s possible to request an exact projectcode export or you could request all changed projects from a timestamp. This last option is an additional Webservice call that is very easy to use. It will tell you what Project to download because they have changes since a timestamp. This Timestamp could be your last donwload moment.
8 )))
9 )))
10
11 {{box title="**Contents**"}}
12 [[image:data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==||height="15" role="presentation" title="Click and drag to move" width="15"]]
13 {{/box}}
14
15 (% class="row" %)
16 (((
17 (% class="col-xs-12 col-sm-8" %)
18 (((
19 == Changelog ==
20
21 === Update 2022-08-23 ===
22
23 As part of on-going efforts to improve performance and scalability, we have introduced a dedicated version of DataWS named DataWSExternals.  This new service should be used for external API consumers.
24
25 | |**URL**|
26 |**Old**|{{code language="none"}}https://web.terraindex.com/DataWS/{{/code}}|(((
27 [[https:~~/~~/web.terraindex.com/DataWS/ITWDataRestService_V1_0/GetProjectsJSON>>https://web.terraindex.com/DataWS/ITWDataRestService_V1_0/GetProjectsJSON]]
28
29 [[https:~~/~~/web.terraindex.com/DataWS/ITWImportExportServiceASMX_V1_0.asmx>>https://web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx]]
30 )))
31 |**New**|​{{code language="none"}}https://web.terraindex.com/DataWSExternals/{{/code}}|(((
32 [[https:~~/~~/web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON>>https://web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON]]
33
34 [[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx>>https://web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx?wsdl]]
35 )))
36
37 == ==
38
39 {{info}}
40 We also have new REST Calls, with the same Input Output formats:
41 \\[[https:~~/~~/web.terraindex.com/datawsExternals/ITWImportExportRestService_V1_0/export>>https://web.terraindex.com/datawsExternals/ITWImportExportRestService_V1_0/export]]
42
43 input as json: ExportRequest
44 output as json: ExportResult
45
46 as  POST  or  GET
47 {{/info}}
48
49 == 1. Retreive all changed project from TerraIndex ==
50
51 To retreive all changed project from the TerraIndex database since a specific timestamp, there is a webservice call you can do. This will return all project rows that have changes since the timestamp you send within the request.
52 This way you only download projects that have changes, and it will not request project that are not needed, so it won’t keep our servers busy with exports that are not necessary.
53
54 To start connecting this webservice, you should use this URL:
55 [[https:~~/~~/web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON>>https://web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON]]
56
57 Fill the **Body **of a **POST **HTTP call with:
58
59 {{code language="JSON" layout="LINENUMBERS"}}
60 {
61 "Authorisation": {
62 "Username": "username",
63 "Password": "password",
64 "Licensenumber": 123,
65 "ApplicationCode": 12,
66 "Language": "en"
67 },
68 "LanguageCode": "en",
69 "WebserviceVersion": "1.0",
70 "SearchFilter": "",
71 "ArchiveID": 0,
72 "PageSize": 30,
73 "LastRowNR": 0,
74 "OrderPreviewBy": 2,
75 "FromDateContentLastChanged": "2019-04-01T00:00:00"
76 }
77 {{/code}}
78
79
80 Set the correct values for:
81
82 * (% class="mark" %)username(%%); as the username in TerraIndex
83 * (% class="mark" %)password(%%); as the username in TerraIndex
84 * (% class="mark" %)LicenseNumber(%%); as your companies license number
85 * (% class="mark" %)ApplicationCode(%%); as provided by TerraIndex to you, if not provided, request one at: service@terraindex.com
86 * (% class="mark" %)PageSize (%%)is in the example set to 30, it will return max 30 projects if possible. This can be upgraded to more records, but it will take longer.
87 * (% class="mark" %)FromDateContentLastChanged(%%); set the correct timestamp of your last call, it will return all projects that have been changed since that timestamp.
88 * (% class="mark" %)SearchFilter(%%); set a part of the projectcode in this field and it will search for projectcodes with this specific text part in it. It will add wildcars in front and at the end of the searchfilter automatically. So not needed to provide. The searchfilter will be applied on three columns: Project Code, Project Name and Project location City name.
89 * (% class="mark" %)LastRowNR(%%); fill default with zero/'0'. If your project isn’t in the first page of 30, you could use this field for lazy loading. Call the webservice with in the request the LastRowNR = 30, and you will receive project rows 31 t/m 60 (when the pagesize is 30).
90
91 Fill the header with:
92
93 {{code language="none"}}
94 application/json
95 {{/code}}
96
97
98 You will receive a reponse like this:
99
100 {{code language="JSON" layout="LINENUMBERS"}}
101 [
102 {
103 "PrID": 242,
104 "PrCode": "2018-010-DEMO",
105 "PrName": "TU Delft, the Netherlands",
106 "PrTypeCode": null,
107 "PrLocName": null,
108 "PrLocCity": null,
109 "PrLeaderCode": "Consult",
110 "PrConsultancyFirm": "TerraIndex",
111 "PrFieldworkFirm": "TerraIndex",
112 "PrPrincipalName": null,
113 "PrDateLastChanged": "2018-08-31T11:12:50.45",
114 "RowNumber": 1,
115 "Uitwissel": 0,
116 "geometryWKT_WGS84": "POINT (6.1000890695634133 52.58846240818189)"
117 },
118 {
119 "PrID": 241,
120 "PrCode": "2018-009-DEMO",
121 "PrName": "TU Delft, the Netherlands",
122 "PrTypeCode": null,
123 "PrLocName": null,
124 "PrLocCity": null,
125 "PrLeaderCode": "Consult",
126 "PrConsultancyFirm": "TerraIndex",
127 "PrFieldworkFirm": "TerraIndex",
128 "PrPrincipalName": null,
129 "PrDateLastChanged": "2018-08-31T11:12:48.603",
130 "RowNumber": 2,
131 "Uitwissel": 0,
132 "geometryWKT_WGS84": "POINT (6.1000890695634133 52.58846240818189)"
133 },
134 {
135 "PrID": 240,
136 "PrCode": "2018-008-DEMO",
137 "PrName": "TU Delft, the Netherlands",
138 "PrTypeCode": null,
139 "PrLocName": null,
140 "PrLocCity": null,
141 "PrLeaderCode": "Consult",
142 "PrConsultancyFirm": "TerraIndex",
143 "PrFieldworkFirm": "TerraIndex",
144 "PrPrincipalName": null,
145 "PrDateLastChanged": "2018-08-31T11:12:46.46",
146 "RowNumber": 3,
147 "Uitwissel": 0,
148 "geometryWKT_WGS84": "POINT (6.1000890695634133 52.58846240818189)"
149 },
150 {
151 "PrID": 239,
152 "PrCode": "2018-007-DEMO",
153 "PrName": "TU Delft, the Netherlands",
154 "PrTypeCode": null,
155 "PrLocName": null,
156 "PrLocCity": null,
157 "PrLeaderCode": "Consult",
158 "PrConsultancyFirm": "TerraIndex",
159 "PrFieldworkFirm": "TerraIndex",
160 "PrPrincipalName": null,
161 "PrDateLastChanged": "2018-08-31T11:12:44.853",
162 "RowNumber": 4,
163 "Uitwissel": 0,
164 "geometryWKT_WGS84": "POINT (6.1000890695634133 52.58846240818189)"
165 },
166 {
167 "PrID": 238,
168 "PrCode": "2018-006-DEMO",
169 "PrName": "TU Delft, the Netherlands",
170 "PrTypeCode": null,
171 "PrLocName": null,
172 "PrLocCity": null,
173 "PrLeaderCode": "Consult",
174 "PrConsultancyFirm": "TerraIndex",
175 "PrFieldworkFirm": "TerraIndex",
176 "PrPrincipalName": null,
177 "PrDateLastChanged": "2018-08-31T11:12:43.033",
178 "RowNumber": 5,
179 "Uitwissel": 0,
180 "geometryWKT_WGS84": "POINT (6.1000890695634133 52.58846240818189)"
181 },
182 {
183 "PrID": 237,
184 "PrCode": "2018-005-DEMO",
185 "PrName": "TU Delft, the Netherlands",
186 "PrTypeCode": null,
187 "PrLocName": null,
188 "PrLocCity": null,
189 "PrLeaderCode": "Consult",
190 "PrConsultancyFirm": "TerraIndex",
191 "PrFieldworkFirm": "TerraIndex",
192 "PrPrincipalName": null,
193 "PrDateLastChanged": "2018-08-31T11:12:41.273",
194 "RowNumber": 6,
195 "Uitwissel": 0,
196 "geometryWKT_WGS84": "POINT (6.1000890695634133 52.58846240818189)"
197 },
198 {
199 "PrID": 236,
200 "PrCode": "2018-004-DEMO",
201 "PrName": "TU Delft, the Netherlands",
202 "PrTypeCode": null,
203 "PrLocName": null,
204 "PrLocCity": null,
205 "PrLeaderCode": "Consult",
206 "PrConsultancyFirm": "TerraIndex",
207 "PrFieldworkFirm": "TerraIndex",
208 "PrPrincipalName": null,
209 "PrDateLastChanged": "2018-08-31T11:12:39.57",
210 "RowNumber": 7,
211 "Uitwissel": 0,
212 "geometryWKT_WGS84": "POINT (6.1000890695634133 52.58846240818189)"
213 },
214 {
215 "PrID": 235,
216 "PrCode": "2018-003-DEMO",
217 "PrName": "TU Delft, the Netherlands",
218 "PrTypeCode": null,
219 "PrLocName": null,
220 "PrLocCity": null,
221 "PrLeaderCode": "Consult",
222 "PrConsultancyFirm": "TerraIndex",
223 "PrFieldworkFirm": "TerraIndex",
224 "PrPrincipalName": null,
225 "PrDateLastChanged": "2018-08-31T11:12:37.77",
226 "RowNumber": 8,
227 "Uitwissel": 0,
228 "geometryWKT_WGS84": "POINT (6.1000890695634133 52.58846240818189)"
229 },
230 {
231 "PrID": 234,
232 "PrCode": "2018-002-DEMO",
233 "PrName": "TU Delft, the Netherlands",
234 "PrTypeCode": null,
235 "PrLocName": null,
236 "PrLocCity": null,
237 "PrLeaderCode": "Consult",
238 "PrConsultancyFirm": "TerraIndex",
239 "PrFieldworkFirm": "TerraIndex",
240 "PrPrincipalName": null,
241 "PrDateLastChanged": "2018-08-31T11:12:36.02",
242 "RowNumber": 9,
243 "Uitwissel": 0,
244 "geometryWKT_WGS84": "POINT (6.1000890695634133 52.58846240818189)"
245 },
246 {
247 "PrID": 233,
248 "PrCode": "2018-001-DEMO",
249 "PrName": "TU Delft, the Netherlands",
250 "PrTypeCode": null,
251 "PrLocName": null,
252 "PrLocCity": null,
253 "PrLeaderCode": "Consult",
254 "PrConsultancyFirm": "TerraIndex",
255 "PrFieldworkFirm": "TerraIndex",
256 "PrPrincipalName": null,
257 "PrDateLastChanged": "2018-08-31T11:12:30.037",
258 "RowNumber": 10,
259 "Uitwissel": 0,
260 "geometryWKT_WGS84": "POINT (4.3694882989839243 52.00722295311251)"
261 }
262 ]
263 {{/code}}
264
265 The **PrID **can be used as **ProjectID **in the next call to get the actual project xml file export.
266
267
268 == 2. Retreive the project export from TerraIndex ==
269
270 To request the export from TerraIndex we have a SOAP webservice. This webservice is called the ExportService, and it will provide a full project in TerraIndex Format.
271 The format of the projectfile is documentated here: [[Documentation TerraIndex Export format - dsFieldProject.xsd>>Implementation documentation.For customers.Documentation TerraIndex Export format - dsFieldProject\.xsd.WebHome]]
272
273 To start connecting this webservice, you should use this URL of the Import Export Webservice:
274
275 [[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc>>https://web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc]]
276
277 With this URL many IDE’s can create a proxy for you, just by providing the URL. Once this proxy is created, you will have a few classes looking like the call in the image below.
278
279 [[image:image-20200108-123431.png]]
280
281 The image is created with WebserviceStudio to visualise the SOAP call to send to the webservice.
282 This is the explanation of each number inside the image~:
283 1; The endpoint URL
284 2; Create the proxy based on the WSDL
285 3; Select the export call to see what it looks like
286 4; Fill the username + password of the TerraIndex user* to call the webservice with.
287 Also fill the license and the applicationCode. //(These two fields can be requested at the TerraIndex Servicedesk.)//
288 5; Fill the **ExportType **'**Export_FIELD_XML_v1_0_0**’. This export corresponds with dsFieldProject.xsd and is the best XML to connect TI with.
289 Create at least create 2 parameters as in the image. Beacause 2 parameters are needed.
290 //If JSON is prevered use: ExportType = 'Export_FIELD_JSON_v1_0_0'
291 For other export types, see the end of this page//
292 6; Fill the parameter with the FileName.
293 7; Fill the parameter with **projectID**. Instead of ‘ProjectID' it’s also possible to fill the parameter ‘ProjectCode'.
294 8; Send the request and wait for the reponse. In response field ‘ResultCode’ should be 'SUCCES’ when it all went OK. If not it will tell what went wrong.
295 9; The response field 'Filecontent’is filled if it went OK, and it contains XML you can serialize.
296 10; an extra parameter is added calles: **UseZipStream**. The result data is default Base64 encoded, if you add UseZipStream = true, the result string is GZIPSTREAMED Base64 encoded. **At the end of this page, we have added an class as code, to parse the base64 or ZIPStream Base64 to a normal string.**
297 *Username and password are known by each TI user and the application manager of your company can create new usernames.
298
299
300 **EXAMPLE CODE**
301
302 ExportType:
303 ITWorks.TerraIndex.ImportExportTest.ImportExportServiceTest.ExportType.Export_Field_XML_v1_0_0;
304
305 {{code language="C#" layout="LINENUMBERS"}}
306 [TestMethod] public void Export_FieldXml_Local() {
307 ITWorks.TerraIndex.ImportExportTest.ImportExportServiceTest.TWImportExportServiceASMX_V1_0SoapClient client = new ITWorks.TerraIndex.ImportExportTest.ImportExportServiceTest.TWImportExportServiceASMX_V1_0SoapClient();
308 ITWorks.TerraIndex.ImportExportTest.ImportExportServiceTest.ExportRequest req = new ITWorks.TerraIndex.ImportExportTest.ImportExportServiceTest.ExportRequest() {
309 AuthorisationRequest = new ITWorks.TerraIndex.ImportExportTest.ImportExportServiceTest.AuthorisationRequest() {
310 Username = "xxxxx", Password = "xxxxx", Licensenumber = "x"
311 }, LanguageCode = "eng", WebserviceVersion = "1.0",
312 };
313 req.TypeOfExport = ITWorks.TerraIndex.ImportExportTest.ImportExportServiceTest.ExportType.Export_Field_XML_v1_0_0;
314 req.UseZipStream = true;
315 List < ExportParameter > paramsList = new List < ExportParameter > ();
316 paramsList.Add(new ExportParameter() {
317 ParameterType = ExportParameterType.FileName, StringValue = "Export"
318 });
319 paramsList.Add(new ExportParameter() {
320 ParameterType = ExportParameterType.ProjectID, FloatValue = 917
321 });
322 req.Parameters = paramsList;
323 try {
324 var result = client.Export(req);
325 if (result != null) {
326 if (result.ResultCode == ITWorks.TerraIndex.ImportExportTest.ImportExportServiceTest.ExportResultCode.Export_Succes) {
327 System.IO.File.WriteAllText(@ "C:\Temp\ExportTestField.xml", result.Files[0].FileContent);
328 System.IO.File.WriteAllText(@ "C:\Temp\ExportTestField.html", result.ExportLog);
329 } else {
330 throw new Exception(result.ResultCode.ToString() + " - " + result.ResultMessage);
331 }
332 }
333 } catch (Exception e) {
334 throw e;
335 }
336 }
337 {{/code}}
338
339 Example call
340
341 {{code language="none" layout="LINENUMBERS"}}
342 <soapenv:Envelope
343 xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
344 xmlns:itw="https://wsterraindex.terraindex.com/ITWorks.TerraIndex/">
345 <soapenv:Header></soapenv:Header>
346 <soapenv:Body>
347 <itw:Export>
348 <itw:request>
349 <itw:AuthorisationRequest>
350 <itw:Username>USERNAME</itw:Username>
351 <itw:Password>PASSWORD</itw:Password>
352 <itw:Licensenumber>LICENSE</itw:Licensenumber>
353 <itw:ApplicationCode>APPCODE</itw:ApplicationCode>
354 </itw:AuthorisationRequest>
355 <itw:WebserviceVersion>1.0</itw:WebserviceVersion>
356 <itw:LanguageCode>nld</itw:LanguageCode>
357 <itw:UseCompression>true</itw:UseCompression>
358 <itw:TypeOfExport>Export_FIELD_XML_v1_0_0</itw:TypeOfExport>
359 <itw:Parameters>
360 <itw:ExportParameter>
361 <itw:ParameterType>FileName</itw:ParameterType>
362 <itw:StringValue>Export</itw:StringValue>
363 </itw:ExportParameter>
364 <itw:ExportParameter>
365 <itw:ParameterType>projectID</itw:ParameterType>
366 <itw:FloatValue>917</itw:FloatValue>
367 </itw:ExportParameter> -----
368 <itw:ExportParameter>
369 <itw:ParameterType>ProjectCode</itw:ParameterType>
370 <itw:StringValue>202020</itw:StringValue>
371 </itw:ExportParameter> ----
372 </itw:Parameters>
373 <itw:LogFormat>XML</itw:LogFormat>
374 <itw:UseZipStream>true</itw:UseZipStream>
375 </itw:request>
376 </itw:Export>
377 </soapenv:Body>
378 </soapenv:Envelope>
379 {{/code}}
380
381 Example response:
382
383 {{code language="none"}}
384 <soap:Envelope
385 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
386 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
387 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
388 <soap:Body>
389 <ExportResponse
390 xmlns="https://wsterraindex.terraindex.com/ITWorks.TerraIndex/">
391 <ExportResult>
392 <ResultCode>Export_Succes</ResultCode>
393 <TypeOfExport>Export_TI_v1_0_0</TypeOfExport>
394 <Files>
395 <File>
396 <FileName>917.xml</FileName>
397 <TypeOfFile>Field_XML_Compressed</TypeOfFile>
398 <FileContent>H4sIAAAAAAAEAFWRuZaqQABEP4hAGnAGggm6odlREFkkA2WRRRCBxv76YeYF70yFVXUqqBvgl4KQBzcZ8Aho2iqxdhxDSPDmNGjz9Z/weMa8/aimTAUeF42KgxRRzd3YaGfdXtvECEBvWafSNwf+dOsjVXpZUzs+lw/p3gBhuXQ5S8T3MdIBlxUQEam+LOVgVo4D8w4c2E8pEgp3haewcpQx1KQ41Z8DKWv16seaDLp3GABLuIKXK5Ucq31EfSXm0172YvG87hcbayYGdB1t0CbcuueLpU5UawgHSitFr564Aet5LeegD0/tocZDTvuIuc9Ja0tDFt/m7kZnomdVJc+2SkqBGXmTdPiiPzJa2OznLkX67p2PCNM7iHU11QbIilVkMDBVd0J8gK4Ams6ycJQagnww/SaxuiZ/EdS6DZ0cf17BIhUq87CSkQvxat/2dEG1xu94BoaeT7C8XR38/C1DZbpygwfW+gk8Z+Mgm3DDhAj8r6099Rj+5YNs5F3+5R5EUPmd6+EvYvj1Dd8o9lLwAQAA</FileContent>
399 </File>
400 <File>
401 <FileName>ProjectInfo.xml</FileName>
402 <TypeOfFile>Field_XML_Compressed</TypeOfFile>
403 <FileContent>H4sIAAAAAAAEAI1Qy5JDQAD8IAdj1/M4hJggDBnEbTxDsV7BxtdvNqm9bx+6urq7+tBEnw+qiuETCLrcTlst9Pajtb0soj7JeynztNIubHK9XZJOXoojN8dXpaxltOlOwAZzK033Edx7HWT1ZFVYNljpsT7iCVDbxb5tlmw3GhV7vgty5jqiGzWSYEvL7RCIQifzchIoMJnHz+fO17C4JAwA0hNRb247SR1ba8OunCV4ralK1rjwBhUAJ2pihopeuxqXIUecePETLhx8zT6IZX5GzafC0XHTrauISeyIM2+2g1PzEymRZrTtglKlsFYHXDKmoYTp+jw1zNDyAFZOTN9XHkuNGmU33905uipWMTsjm2ccm6+bxqk2xAjCf/z3BwS1j+qVqTjrlDGJziCIhC59CHwafeNgI8d3U4cQQ+VXSdXb+QGLuAuvrAEAAA==</FileContent>
404 </File>
405 </Files>
406 </ExportResult>
407 </ExportResponse>
408 </soap:Body>
409 </soap:Envelope>
410 {{/code}}
411
412
413 **List of export types:**
414
415 * Export_TI_v1_0_0
416 * Export_FIELD_XML_v1_0_0
417 * Export_FIELD_JSON_v1_0_0
418 * Export_Field_Codelist_XML
419 * Export_Field_Codelist_JSON
420 * Export_OVAM_MISTRAL2_v8_4_0
421 * Export_DOV
422 * Export_IMSIKB_v14_3_0
423 * Export_IMSIKB_v13_5_0
424 * Export_BRO_GMW
425 * Export_BRO_BHR_GT
426 * Export_BRO_GAR
427 * Export_IMSIKB_v14_7_0
428 * Export_IMSIKB_v14_8_0
429 * Export_BRO_SAD_IMBROA_Registration
430 * Export_BRO_SAD_IMBROA_Correction
431 * Export_BRO_SAD_IMBRO_Registration
432 * Export_BRO_SAD_IMBRO_Correction
433 * Export_IMSIKB_v14_9_0
434 )))
435
436
437
438 (% class="col-xs-12 col-sm-4" %)
439 (((
440
441 )))
442 )))