An external system calls up the URL of the laboratory database Webservice with username and password and gets back the data record of the evaluation.
X
in the URL with the number of the evaluation).https://labordatenbank.com/demo/stats/view/X/https
https://labordatenbank.com/demo/stats/view/X/https_json
https://labordatenbank.com/demo/stats/view/X/https_json/VAR0/VAR1/VAR2/VAR3/VAR4/DATE/
DATE
: today, yesterday, last_3_days, this_month, last_month, last_6_month, last_12_month, this_year, last_year
### Settings ###
$downloadDirectory = ".\download"
$uri = "http://labordatenbank.com/demo/stats/view/1/https_json"
$user = "testuser"
$pass = "testpassword"
#####################
$b64 = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("${user}:$pass"))
$headers = @{
"Authorization" = "Basic $b64"
}
$download = Invoke-WebRequest -Uri $uri -Headers $headers -UseBasicParsing
$content = [System.Net.Mime.ContentDisposition]::new($download.Headers["Content-Disposition"])
$fileName = $content.FileName
$fullPath = Join-Path -Path $downloadDirectory -ChildPath $fileName
Invoke-WebRequest -Uri $uri -Headers $headers -OutFile $fullPath
### Settings ###
$downloadDirectory = "XXX"
$uri = "https://labordatenbank.com/XXX/stats/view/XXX/https_json"
$user = "XXX"
$pass = "XXX"
$logFileName = "auswertungen.log"
$fullLogPath = Join-Path -Path $downloadDirectory -ChildPath $logFileName
Start-Transcript "$fullLogPath" -Append
Base64 decoding¶
$b64 = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("${user}:$pass"))
$headers = @{
"Authorization" = "Basic $b64"
}
Download¶
$download = Invoke-RestMethod -Uri $uri -Headers $headers -UseBasicParsing
if($downloadDirectory){
foreach($entry in $download){
$downloadLink = $entry.'Download-Link'
$fileName = $entry.Dateiname
$fullPath = Join-Path -Path $downloadDirectory -ChildPath $fileName
Write-Host "<--- $fileName --->"
if(![System.IO.File]::Exists($fullPath)){
Invoke-WebRequest -Uri $downloadLink -OutFile $fullPath
if($fullPath){
Write-Host "$filename Downloaded successfully." -ForegroundColor Green
} else {
Write-Host "Error when downloading the file." -ForegroundColor Red
}
} else {
Write-Host "The file $fileName already exists!" -ForegroundColor Red
}
}
} else {
Write-Host "The path could not be found!" -ForegroundColor Red
}
Stop-Transcript
Last change: 16.01.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