HTTP report Json output

I want to get a json formatted report output from Duplicati. If I use the following I get a text output. And it works

–send-http-result-output-format=Duplicati
–send-http-url=https://URL/index.php

index.php

<?php
$file = 'report.txt';
$current .= $_POST['message'];
$current .= "\r\n";
$current .= "-------------------------------------------------------\r\n";
file_put_contents($file, $current, FILE_APPEND);
?>

But changing

–send-http-result-output-format=Json

I get no output at all.
Can anyone help? Thanks

By setting
–send-mail-result-output-format=Json
I get a proper Json email output but not on the HTTTP

For now I just want to save the Json to a text file.

Anyone have a idea?

Welcome to the forum @Mark_Stoehr

Nothing direct from me, but maybe ideas on troubleshooting. For example, is there a server log that says whether anything came in? netstat usually shows some lingering addresses after a connection as well. Crude way on a Linux or similar remote would ls -lu --full-time on the index.php file for file access.

looks kind of like Duplicati logging at verbose level (e.g. About → Show log → Live → Verbose) might log. Testing that theory could be done in a working config such as your original, then use JSON and compare.

Is there any long output being inserted, or just the brief statistics? There are some length limits around…

Im using the followinf PHP that will log all PHP varibles to the Txt file

<?php
$file = 'report.txt';
$arr = get_defined_vars();
$current .= print_r($arr, true);
$current .= "\r\n";
$current .= "-------------------------------------------------------\r\n";
file_put_contents($file, $current, FILE_APPEND);
?>

With
–send-http-result-output-format=Duplicati
I GET

Array
(
[_GET] => Array
(
)

[_POST] => Array
    (
        [message] => Duplicati Backup report for test10-stoehrserver

DeletedFiles: 0
DeletedFolders: 0
ModifiedFiles: 0
ExaminedFiles: 9
OpenedFiles: 0
AddedFiles: 0
SizeOfModifiedFiles: 0
SizeOfAddedFiles: 0
SizeOfExaminedFiles: 12170845
SizeOfOpenedFiles: 0
NotProcessedFiles: 0
AddedFolders: 0
TooLargeFiles: 0
FilesWithError: 0
ModifiedFolders: 0
ModifiedSymlinks: 0
AddedSymlinks: 0
DeletedSymlinks: 0
…etc

BUT WITH
–send-http-result-output-format=Json
I Get nothing not even the $_POST[‘message’]

Array
(
[_GET] => Array
(
)

[_POST] => Array
    (
    )

[_COOKIE] => Array
    (
    )

[_FILES] => Array
    (
    )

[file] => report.txt

)

Did you manage to get it working in Json format?
I have tried a thousand ways in the index.php and it supports the duplicati format, but not Json. Even configuring it at a general level I get the same result, it does not create the .json file
Thank you!!

I haven’t done any testing but it looks like the problem could be at line 204 in the code page @ts678 linked to. Unless ‘body’ is already Json I don’t see how it would work, now it is <9AM on a Sunday so I could easily be missing something but that’s where I’d start looking.

        if (ExportFormat == ResultExportFormat.Json)
        {
            contenttype = "application/json";
            data = Encoding.UTF8.GetBytes(body);
        }
        else
        {
            contenttype = "application/x-www-form-urlencoded";
            var postData = $"{m_messageParameterName}={System.Uri.EscapeDataString(body)}";
            if (!string.IsNullOrEmpty(m_extraParameters))
            {
                postData += $"&{System.Uri.EscapeUriString(m_extraParameters)}";
            }
            data = Encoding.UTF8.GetBytes(postData);
        }

But where is that piece of code supposed to be reviewed. And if it is possible that I can modify it.
Tanks!!

Duplicati is an open source project so anyone can get the source code and modify it.

First get a GitHub account, clone the Duplicati repository (this is the source code), open the source code in Visual Studio, learn C#, change the code, test the code, publish a pull request for the issue that you’ve resolved and if the change is accepted it will likely show up in the next release of Duplicati.

Although I have downloaded it I have taken a look at it and I am not at all familiar with its development environment. With what unfortunately I consider that what it tells me I will not be able to do it. Unfortunately.
I would be trying to do something outside the scope of my possibilities and my knowledge.
Thank you!