Bug in REST response when calling from PowerShell

These three characters need to be removed so PowerShell can convert REST response to PowerShell object.

Can you show me what command you used to collect this info? It will help me troubleshoot/debug. I am very familiar with powershell but haven’t tried using it to query Duplicati REST API directly.

Feature Request - REST API #4100 came in on Feb 13, 3 days before this. My comment there was:

I’m not certain this was meant to be a published interface

Past “published” are “supported” and “stable”. The main focus is on getting essential backup stable, meaning working reliably and easily enough to exit Beta. “Stable” for an API may mean low-change.

My thinking on the three characters (although I’m far from an expert) is it’s a UTF-8 byte order mark. Presumably there’s some way to remove such a common thing in PowerShell (may vary by version).

Web search finds big debate about whether using these is a good thing or a bad thing. I’ll stay out…

Here’s one I made with notepad.exe, saving as “UTF-8 with BOM” on the “Save as type” dropdown:

image

If you’re trying to do automation, you might also see talk at above feature request which mentioned:

A command line client for controlling the Duplicati Server that was built on reverse engineered APIs which presumably can still be changed (and client must adapt) if Duplicati requires such changes…

I’ve used this:

I didn’t work a lot with REST, but never had a problem that I need to cut some characters when JSON object received.This is why I report it as bug.

In any case, I found easy way to convert it to PowerShell object:

$backups.Substring(3) | ConvertFrom-Json

2 Likes