X
in der URL mit der Nummer der Importschnittstelle zu ersetzen ist).
https://labordatenbank.at/manual_page/276/demo/imports/import/X/0/https
https://username:password@labordatenbank.com/demo/imports/import/X/0/https
$url = "https://labordatenbank.at/manual_page/276/demo/imports/import/X/0/https";
$username = 'abc';
$password = '********';
// Dateiname mit Probenummer
$post['file'] = new CurlFile('Messdaten.csv');
// Daten senden
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
$url = "https://labordatenbank.at/manual_page/276/demo/imports/import/X/0/https";
$username = 'abc';
$password = '********';
// Datei mit Probenummer im Dateinamen vorbereiten
$post['file'] = new CurlFile('P=date('y')?>00123.jpg');
$post['sample_name'] = 'P=date('y')?>00123'; // Verlinkung mit einer Probe (alternativ zum Dateinamen)
$post['description'] = 'Probenabmessungen 13mm x 60mm'; // Beschreibung der Datei
$post['parametertype_id'] = 123; // Datei zu einem Parameter der Probe hinzufügen
$post['column'] = 0; // Parameterspalte
// Daten senden
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
$watchedDirectory = ".\import\"
$writeaction = {
$moveTo = ".\imported\"
function Import-File {
param (
$filePath,
$moveTo
)
$uri = "https://labordatenbank.at/manual_page/276/demo/imports/import/23/0/https"
$user = "testuser"
$pass = "testpassword"
$file = Get-Item($filePath);
$fileContent = [system.io.file]::readallbytes($filePath);
$b64 = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("${user}:$pass"))
$headers = @{
"Authorization" = "Basic $b64"
}
$boundary = [System.Guid]::NewGuid().ToString()
$LF = "`r`n"
$fileEnc = [System.Text.Encoding]::GetEncoding('ISO-8859-1').GetString($fileContent);
$body = (
"--$boundary",
"Content-Disposition: form-data; name=`"file`"; filename=`"$($file.Basename)$($file.Extension)`"",
"Content-type: image/jpg",
"",
$fileEnc,
"--$boundary"
)
$body = $body -join $LF
try {
Invoke-RestMethod -Uri $uri -Method POST -Headers $headers -ContentType "multipart/form-data; boundary=`"$boundary`"" -Body $body
Write-Host "Datei importiert: ", $filePath
# Soll die Datei nach dem Import verschoben werden?
Move-Item -Path $filePath -Destination $moveTo
} catch {
Write-Host "Fehler beim Import:" $_.Exception.Response.StatusCode.value__
Write-Host $_.Exception.Response.StatusDescription
}
}
$path = $Event.SourceEventArgs.FullPath
Import-File $path $moveTo
}
$finalPath = Resolve-Path $watchedDirectory
$filewatcher = New-Object System.IO.FileSystemWatcher
$filewatcher.Path = $finalPath
$filewatcher.Filter = "*.*"
$filewatcher.EnableRaisingEvents = $true
Unregister-Event -SourceIdentifier "LDB-Watcher" -ErrorAction:SilentlyContinue
Register-ObjectEvent $filewatcher "Created" -Action $writeaction -SourceIdentifier "LDB-Watcher"
while ($true) {
Start-Sleep 5
}
$uri = "https://labordatenbank.at/manual_page/276/demo/imports/import/X/0/https"
$user = "abc"
$pass = "********"
# Datei mit Probenummer im Dateinamen vorbereiten
$filePath = Get-Item("./P210049.jpg");
$file = Get-Item($filePath);
$fileContent = [system.io.file]::readallbytes($filePath);
# Optionale Parameter
$bodyParameter = @{
# Verlinkung mit einer Probe (alternativ zum Dateinamen)
"sample_name" = "210052";
# Beschreibung der Datei
"description" = "Probenabmessungen 13mm x 60mm";
# Datei zu einem Parameter der Probe hinzufügen
"parametertype_id" = 123456;
# Parameterspalte
"column" = 0;
}
$b64 = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("${user}:$pass"))
$headers = @{
"Authorization" = "Basic $b64"
}
$boundary = [System.Guid]::NewGuid().ToString()
$LF = "`r`n"
$fileEnc = [System.Text.Encoding]::GetEncoding('ISO-8859-1').GetString($fileContent);
$body = (
"--$boundary",
"Content-Disposition: form-data; name=`"file`"; filename=`"$($file.Basename)$($file.Extension)`"",
"Content-type: image/jpg",
"",
$fileEnc,
"--$boundary"
)
foreach($parameter in $bodyParameter.Keys) {
$body += "Content-Disposition: form-data; name=`"$parameter`"$LF"
$body += $bodyParameter.Item($parameter)
$body += "--$boundary"
}
$body = $body -join $LF
Invoke-RestMethod -Uri $uri -Method POST -Headers $headers -ContentType "multipart/form-data; boundary=`"$boundary`"" -Body $body
Letzte Änderung: 27.04.2023
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