Das externe System sendet die Daten an die URL der Labordatenbank Importschnittstelle mit Benutzername und Passwort und bekommt als Antwort eine Empfangsbestätigung (Statuscode) zurück.
X
in der URL mit der Nummer der Importschnittstelle zu ersetzen ist).https://labordatenbank.com/demo/imports/import/X/0/https
https://username:password@labordatenbank.com/demo/imports/import/X/0/https
php <br>$url = "https://labordatenbank.com/demo/imports/import/X/0/https"; <br>$username = 'abc'; <br>$password = '********'; <br> <br>// Dateiname mit Probenummer <br>$post['file'] = new CurlFile('Messdaten.csv'); <br> <br>// Daten senden <br>$curl = curl_init($url); <br>curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); <br>curl_setopt($curl, CURLOPT_USERPWD, "$username:$password"); <br>curl_setopt($curl, CURLOPT_POST, true); <br>curl_setopt($curl, CURLOPT_POSTFIELDS, $post); <br>$response = curl_exec($curl); <br>curl_close($curl); <br>echo $response; <br>
php <br>$url = "https://labordatenbank.com/demo/imports/import/X/0/https"; <br>$username = 'abc'; <br>$password = '********'; <br> <br>// Datei mit Probenummer im Dateinamen vorbereiten <br>$post['file'] = new CurlFile('P00123.jpg'); <br> <br> <br>$post['sample_name'] = 'P00123'; // Verlinkung mit einer Probe (alternativ zum Dateinamen) <br>$post['description'] = 'Probenabmessungen 13mm x 60mm'; // Beschreibung der Datei <br>$post['parametertype_id'] = 123; // Datei zu einem Parameter der Probe hinzufügen <br>$post['column'] = 0; // Parameterspalte <br> <br>// Daten senden <br>$curl = curl_init($url); <br>curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); <br>curl_setopt($curl, CURLOPT_USERPWD, "$username:$password"); <br>curl_setopt($curl, CURLOPT_POST, true); <br>curl_setopt($curl, CURLOPT_POSTFIELDS, $post); <br>$response = curl_exec($curl); <br>curl_close($curl); <br>echo $response; <br>
powershell <br>$watchedDirectory = ".\import\" <br> <br>$writeaction = { <br> $moveTo = ".\imported\" <br> <br> function Import-File { <br> param ( <br> $filePath, <br> $moveTo <br> ) <br> $uri = "https://labordatenbank.com/demo/imports/import/23/0/https" <br> $user = "testuser" <br> $pass = "testpassword" <br> <br> $file = Get-Item($filePath); <br> $fileContent = [system.io.file]::readallbytes($filePath); <br> <br> $b64 = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("${user}:$pass")) <br> $headers = @{ <br> "Authorization" = "Basic $b64" <br> } <br> <br> $boundary = [System.Guid]::NewGuid().ToString() <br> $LF = "`r`n" <br> $fileEnc = [System.Text.Encoding]::GetEncoding('ISO-8859-1').GetString($fileContent); <br> <br> $body = ( <br> "--$boundary", <br> "Content-Disposition: form-data; name=`"file`"; filename=`"$($file.Basename)$($file.Extension)`"", <br> "Content-type: image/jpg", <br> "", <br> $fileEnc, <br> "--$boundary" <br> ) <br> <br> $body = $body -join $LF <br> <br> try { <br> Invoke-RestMethod -Uri $uri -Method POST -Headers $headers -ContentType "multipart/form-data; boundary=`"$boundary`"" -Body $body <br> Write-Host "Datei importiert: ", $filePath <br> <br> # Soll die Datei nach dem Import verschoben werden? <br> Move-Item -Path $filePath -Destination $moveTo <br> } catch { <br> Write-Host "Fehler beim Import:" $_.Exception.Response.StatusCode.value__ <br> Write-Host $_.Exception.Response.StatusDescription <br> } <br> } <br> <br> $path = $Event.SourceEventArgs.FullPath <br> <br> Import-File $path $moveTo <br>} <br> <br>$finalPath = Resolve-Path $watchedDirectory <br> <br>$filewatcher = New-Object System.IO.FileSystemWatcher <br>$filewatcher.Path = $finalPath <br>$filewatcher.Filter = "*.*" <br>$filewatcher.EnableRaisingEvents = $true <br> <br>Unregister-Event -SourceIdentifier "LDB-Watcher" -ErrorAction:SilentlyContinue <br>Register-ObjectEvent $filewatcher "Created" -Action $writeaction -SourceIdentifier "LDB-Watcher" <br> <br>while ($true) { <br> Start-Sleep 5 <br>} <br> <br>
powershell <br>$uri = "https://labordatenbank.com/demo/imports/import/X/0/https" <br> <br>$user = "<strong class=red>abc</strong>" <br>$pass = "<strong class=red>********</strong>" <br> <br># Datei mit Probenummer im Dateinamen vorbereiten <br>$filePath = Get-Item("./P210049.jpg"); <br>$file = Get-Item($filePath); <br>$fileContent = [system.io.file]::readallbytes($filePath); <br> <br># Optionale Parameter <br>$bodyParameter = @{ <br> # Verlinkung mit einer Probe (alternativ zum Dateinamen) <br> "sample_name" = "210052"; <br> # Beschreibung der Datei <br> "description" = "Probenabmessungen 13mm x 60mm"; <br> # Datei zu einem Parameter der Probe hinzufügen <br> "parametertype_id" = 123456; <br> # Parameterspalte <br> "column" = 0; <br>} <br> <br>$b64 = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("${user}:$pass")) <br>$headers = @{ <br> "Authorization" = "Basic $b64" <br>} <br> <br>$boundary = [System.Guid]::NewGuid().ToString() <br>$LF = "`r`n" <br>$fileEnc = [System.Text.Encoding]::GetEncoding('ISO-8859-1').GetString($fileContent); <br> <br>$body = ( <br> "--$boundary", <br> "Content-Disposition: form-data; name=`"file`"; filename=`"$($file.Basename)$($file.Extension)`"", <br> "Content-type: image/jpg", <br> "", <br> $fileEnc, <br> "--$boundary" <br>) <br> <br>foreach($parameter in $bodyParameter.Keys) { <br> $body += "Content-Disposition: form-data; name=`"$parameter`"$LF" <br> $body += $bodyParameter.Item($parameter) <br> $body += "--$boundary" <br>} <br> <br>$body = $body -join $LF <br> <br>Invoke-RestMethod -Uri $uri -Method POST -Headers $headers -ContentType "multipart/form-data; boundary=`"$boundary`"" -Body $body <br>
Letzte Änderung: 31.05.2024
Allgemeines
Einführungsphase
Mitarbeiter
Aufträge
Proben
Probenvorlage
Berichte
Berichtstabellen Editor
Kunden
Kundenzone (optional)
Anlagen
Angebote
Rechnungen
Parameter
Rechnen mit Parametern
Schnittstellen
Webservice
Transformationscode
Prüfpläne / Grenzwerte / Spezifikationen
Dokumentenlenkung
Prüfmittel
Material
Mitarbeiterschulungen
8D-Report
Sonstiges
PDF-Vorlagen
Fragen und Antworten
Lieferantenbewertung
Dateiverwaltung
Auswertungen
Prozesse