Changes for page Download a project (export)
Last modified by Robert Jan Daams on 2025/03/05 18:02
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Parent
-
... ... @@ -1,1 +1,1 @@ 1 -Implementation documentation. For customers.WebHome1 +Implementation documentation.WebHome - Content
-
... ... @@ -31,21 +31,11 @@ 31 31 |**New**|{{code language="none"}}https://web.terraindex.com/DataWSExternals/{{/code}}|((( 32 32 [[https:~~/~~/web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON>>https://web.terraindex.com/DataWSExternals/ITWDataRestService_V1_0/GetProjectsJSON]] 33 33 34 -[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportService ASMX_V1_0.asmx>>https://web.terraindex.com/DataWSExternals/ITWImportExportServiceASMX_V1_0.asmx?wsdl]]34 +[[https:~~/~~/web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc>>https://web.terraindex.com/DataWSExternals/ITWImportExportService_V1_0.svc]] 35 35 ))) 36 36 37 37 == == 38 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 49 == 1. Retreive all changed project from TerraIndex == 50 50 51 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. ... ... @@ -268,7 +268,7 @@ 268 268 == 2. Retreive the project export from TerraIndex == 269 269 270 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]]261 +The format of the projectfile is documentated here: [[Documentation TerraIndex Export format - dsFieldProject.xsd>>Implementation documentation.Documentation TerraIndex Export format - dsFieldProject\.xsd.WebHome]] 272 272 273 273 To start connecting this webservice, you should use this URL of the Import Export Webservice: 274 274 ... ... @@ -408,7 +408,137 @@ 408 408 </soap:Envelope> 409 409 {{/code}} 410 410 411 - 401 + 402 +== Zip Stream class == 403 + 404 +If needed, this is the Zip Stream class you can use to extract the zipstream as used above: 405 + 406 +{{code language="Csharp" layout="LINENUMBERS"}} 407 +/// <summary> 408 +/// Helper class for compress en decompress of file data 409 +/// </summary> 410 +public static class ZipStreamHelper { 411 + #region Compress and encode 412 + /// <summary> 413 + /// Comprimeer een string en geeft deze terug in Base64 string. 414 + /// </summary> 415 + /// <param name="content">filecontent</param> 416 + /// <returns>gecomprimeerde string</returns> 417 + public static string CompressToBase64String(string content) { 418 + //string to byte[] 419 + byte[] contentArray = stringToByteArray(content); 420 + // Compress 421 + byte[] compressed = Compress(contentArray); 422 + return base64_encode(compressed); 423 + } 424 + 425 + /// <summary> 426 + /// Zet een string om naar een ByteArray 427 + /// </summary> 428 + /// <param name="content">filecontent</param> 429 + /// <returns>ByteArray</returns> 430 + public static byte[] stringToByteArray(string content) { 431 + System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); 432 + return encoding.GetBytes(content); 433 + } 434 + 435 + /// <summary> 436 + /// comprimeer een ByteArray 437 + /// </summary> 438 + /// <param name="data">filedata als ByteArray</param> 439 + /// <returns>gecomprimeerde ByteArray</returns> 440 + public static byte[] Compress(byte[] data) { 441 + using(var compressedStream = new MemoryStream()) 442 + using(var zipStream = new GZipStream(compressedStream, CompressionMode.Compress)) { 443 + zipStream.Write(data, 0, data.Length); 444 + zipStream.Close(); 445 + return compressedStream.ToArray(); 446 + } 447 + } 448 + 449 + /// <summary> 450 + /// Zet een ByteArray om naar een Base64 string 451 + /// </summary> 452 + /// <param name="data">gecomprimeerde ByteArray</param> 453 + /// <returns>Base 64 string</returns> 454 + public static string base64_encode(byte[] data) { 455 + if (data == null) 456 + return string.Empty; 457 + return Convert.ToBase64String(data); 458 + } 459 + 460 + /// <summary> 461 + /// Zet een string om naar een Base64 string 462 + /// </summary> 463 + /// <param name="data">string</param> 464 + /// <returns>Base 64 string</returns> 465 + public static string string_base64_encode(string data) { 466 + if (string.IsNullOrEmpty(data)) 467 + return string.Empty; 468 + 469 + //string to byte[] 470 + byte[] contentArray = stringToByteArray(data); 471 + return base64_encode(contentArray); 472 + } 473 + #endregion 474 + 475 + #region Decompress and decode 476 + // Decode and decompress 477 + /// <summary> 478 + /// Decomprimeer een Base64 string naar een string 479 + /// </summary> 480 + /// <param name="contentBase64">GZIP Base64 string</param> 481 + /// <returns>string</returns> 482 + public static string DecompressBase64StringToString(string contentBase64) { 483 + // Decompress 484 + byte[] decoded = base64_decode(contentBase64); 485 + byte[] decompressed = Decompress(decoded); 486 + 487 + return byteArrayTostring(decompressed); 488 + } 489 + 490 + /// <summary> 491 + /// Zet een ByteArray om in een normale string 492 + /// </summary> 493 + /// <param name="data">ByteArray</param> 494 + /// <returns>string</returns> 495 + public static string byteArrayTostring(byte[] data) { 496 + System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); 497 + return enc.GetString(data); 498 + } 499 + 500 + /// <summary> 501 + /// Zet een Base64 string om naar een ByteArray 502 + /// </summary> 503 + /// <param name="encodedData">Base64 string</param> 504 + /// <returns>gecomprimeerde ByteArray</returns> 505 + public static byte[] base64_decode(string encodedData) { 506 + byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData); 507 + return encodedDataAsBytes; 508 + } 509 + 510 + /// <summary> 511 + /// Zet een gecomprimeerde ByteArray om in een ByteArray 512 + /// </summary> 513 + /// <param name="data">gecomprimeerde ByteArray</param> 514 + /// <returns>ByteArray (gedecomprimeerd)</returns> 515 + public static byte[] Decompress(byte[] data) { 516 + using(var compressedStream = new MemoryStream(data)) 517 + using(var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress)) 518 + using(var resultStream = new MemoryStream()) { 519 + var buffer = new byte[4096]; 520 + int read; 521 + 522 + while ((read = zipStream.Read(buffer, 0, buffer.Length)) > 0) { 523 + resultStream.Write(buffer, 0, read); 524 + } 525 + 526 + return resultStream.ToArray(); 527 + } 528 + } 529 + #endregion 530 +} 531 +{{/code}} 412 412 ))) 413 413 414 414