Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Set acknowledge status of a Cloudron Notification via API doesn't work

    N8N
    2
    7
    227
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      manngobaum last edited by

      Hi,

      I try to set a notification to read after I consumed it via API and forwarded it to Telegram. Unfortunatly I am recieving the following failure:

      https://my.xxx.de/api/v1/notifications/"49"
      
      {"status":"rejected","reason":{"message":"404 - {\"status\":\"Not Found\",\"message\":\"Notification not found\"}",
      "name":"Error","stack":"Error: Request failed with status code 404\n    at createError (/app/code/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/app/code/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/app/code/node_modules/axios/lib/adapters/http.js:269:11)\n    at IncomingMessage.emit (node:events:539:35)\n    at endReadableNT (node:internal/streams/readable:1345:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"}}
      

      Any ideas what to change?

      Best,
      Sven

      girish 1 Reply Last reply Reply Quote 0
      • girish
        girish Staff @manngobaum last edited by

        @manngobaum said in Set acknowledge status of a Cloudron Notification via API doesn't work:

        https://my.xxx.de/api/v1/notifications/"49"

        is the quote around 49 intentional? there should be no quote

        M 1 Reply Last reply Reply Quote 0
        • M
          manngobaum @girish last edited by

          @girish I tried it without quotes in first place:

          https://my.xxx.de/api/v1/notifications/49
          

          But using it I am receiving the following failure:

          {"status":"rejected","reason":{"message":"400 - {\"status\":\"Bad Request\",\"message\":\"acknowledged must be a booliean\"}","name":"Error","stack":"Error: Request failed with status code 400\n    at createError (/app/code/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/app/code/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/app/code/node_modules/axios/lib/adapters/http.js:269:11)\n    at IncomingMessage.emit (node:events:539:35)\n    at endReadableNT (node:internal/streams/readable:1345:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"}}
          
          girish 1 Reply Last reply Reply Quote 0
          • girish
            girish Staff @manngobaum last edited by girish

            @manngobaum said in Set acknowledge status of a Cloudron Notification via API doesn't work:

            acknowledged must be a booliean

            You must send acknowledged to be true in the body of the POST request.

            M 1 Reply Last reply Reply Quote 0
            • M
              manngobaum @girish last edited by manngobaum

              @girish Thanks for your answer! I also tried this in first place. But I think something is wrong:

              {
                "nodes": [
                  {
                    "parameters": {
                      "requestMethod": "POST",
                      "url": "=https://my.xxx.de/api/v1/notifications/{{$node[\"Item Lists\"].json[\"id\"]}}",
                      "options": {},
                      "bodyParametersUi": {
                        "parameter": [
                          {
                            "name": "acknowledged",
                            "value": "true"
                          }
                        ]
                      },
                      "headerParametersUi": {
                        "parameter": [
                          {
                            "name": "authorization",
                            "value": "Bearer xxx"
                          }
                        ]
                      }
                    },
                    "name": "HTTP Request1",
                    "type": "n8n-nodes-base.httpRequest",
                    "typeVersion": 2,
                    "position": [
                      1100,
                      300
                    ]
                  }
                ],
                "connections": {}
              }
              

              With this failure:

              {"status":"rejected","reason":{"message":"400 - {\"status\":\"Bad Request\",\"message\":\"acknowledged must be a booliean\"}","name":"Error","stack":"Error: Request failed with status code 400\n    at createError (/app/code/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/app/code/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/app/code/node_modules/axios/lib/adapters/http.js:269:11)\n    at IncomingMessage.emit (node:events:539:35)\n    at endReadableNT (node:internal/streams/readable:1345:12)\n    at processTicksAndRejections (node:internal/process/task_queues:83:21)"}}
              
              girish 1 Reply Last reply Reply Quote 0
              • girish
                girish Staff @manngobaum last edited by

                @manngobaum said in Set acknowledge status of a Cloudron Notification via API doesn't work:

                          "value": "true"
                

                This should probably be true (without quotes around it, which would make it boolean true instead of string true).

                M 1 Reply Last reply Reply Quote 1
                • M
                  manngobaum @girish last edited by

                  @girish Yes, this was it. I did not manage to see the actual json. But seems like n8n always adds quotes using the name / value combination. I changed it to this:

                  {
                    "nodes": [
                      {
                        "parameters": {
                          "requestMethod": "POST",
                          "url": "=https://my.xxx.de/api/v1/notifications/{{$node[\"Item Lists\"].json[\"id\"]}}",
                          "jsonParameters": true,
                          "options": {},
                          "bodyParametersJson": "={\n\"acknowledged\": true\n}",
                          "headerParametersJson": "={\"authorization\": \"Bearer xxx\"}"
                        },
                        "name": "HTTP Request1",
                        "type": "n8n-nodes-base.httpRequest",
                        "typeVersion": 2,
                        "position": [
                          1100,
                          300
                        ]
                      }
                    ],
                    "connections": {}
                  }
                  

                  Now it's working. I used this:
                  Bildschirmfoto 2022-06-14 um 18.16.17.png
                  instead of this:Bildschirmfoto 2022-06-14 um 18.16.42.png

                  1 Reply Last reply Reply Quote 2
                  • First post
                    Last post
                  Powered by NodeBB