Issues with sending report http request to caldav api

Hello everyone,

I am new to n8n and learning so please bear with me.

I am trying to send a http REPORT request via the http node to a caldav api

    {
      "parameters": {
        "method": "REPORT",
        "url": "https://mynextcloud/remote.php/dav/calendars/user/calendar/",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mycreds",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "depth",
              "value": "1"
            },
            {
              "name": "prefer",
              "value": "return-minimal"
            }
          ]
        },
        "sendBody": true,
        "contentType": "raw",
        "rawContentType": "application/xml",
        "body": "<c:calendar-query xmlns:d=\"DAV:\" xmlns:c=\"urn:ietf:params:xml:ns:caldav\"><d:prop><c:calendar-data /></d:prop><c:filter><c:comp-filter name=\"VCALENDAR\"><c:comp-filter name=\"VTODO\"></c:comp-filter></c:comp-filter></c:filter></c:calendar-query>",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        208,
        48
      ],
      "id": "21225a26-fc58-4242-85f6-a1754c4fee9a",
      "name": "HTTP Request1",
      "alwaysOutputData": false,
      "credentials": {
        "mycreds": {
          "id": "id",
          "name": "name"
        },
      }
    }

, but I always get this error:

The service was not able to process your request

Sabre\Xml\ParseException The input element to parse is empty. Do not attempt to parse

The strange thing is the same request works in bruno and probably other api testing software. I’ve tried importing into n8n from curl command, changing from OAuth2 to basic auth and adding and removing a bunch of headers, but nothing has worked so far.

So if someone has an idea whats wrong, please share with me.

hello @Nameless

How are you sending a REPORT method, if this method is not supported, and even not in the RFC?

Moreover, the URL doesn’t look like an API URL.

hey welcome, this is actually a known limitation in n8n’s HTTP Request node — it only sends request bodies for POST, PUT, PATCH and GET methods, so your XML body is getting silently dropped for REPORT which is why Sabre complains about empty input. Your config looks correct, the node just doesn’t support WebDAV methods properly yet.

The workaround is to use a Code node with native fetch or the https module to make the request directly. Something like this should work:

You’ll need to swap in your actual credentials in the Authorization header.

1 Like

Hey @barn4k ,

I simplified the URL for this post in the actual call the full URL with user and IP address is present.

To answer your question, I do not know. I do not know how n8n does it underneath, but I assumed with the expression options being there that it might take the inputted text try and figure out which one to use or something. A little bit of guessing.

Hey @achamm ,

I cannot see your code, it shows “Detailed node info is not available”, but I assume its a http request done in javascript or python. I was afraid I might have to do this and its quite unfortunate that the default http node doesn’t support this nor there not being a nextcloud calendar node.

hi, guys! just to clarify something here, the HTTP Request node doesn’t “guess” the body format based on your expression. It sends exactly what you configured: method, headers, and body. Expressions only resolve values dynamically, they don’t change how the request is built internally.

So if Sabre is returning an empty body error, the first thing to confirm is whether the XML is actually being sent by n8n. If you need help with this consultation, let us know here for guidance.

I didnt import it correctly, ill fix it shortly.

Thank you. Unfortunately fetch did not work for me, most likely due to nextcloud having a self signed certificate and I’ve tried several things. I probably could have disable the cert checking the container variables, but I did not want to do that and also I’ve already had the nextcloud certifcate in the “/opt/custom-certificates” mounted and it strangely didn’t work.

So my solutions was to use axios instead and set agent to “new https.Agent({ rejectUnauthorized: false })” and it works perfectly.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.