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


  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Cloudron Forum

Apps | Demo | Docs | Install

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

Scheduled Pinned Locked Moved N8N
7 Posts 2 Posters 241 Views
    • 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 Offline
    M Offline
    manngobaum
    wrote on last edited by
    #1

    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

    girishG 1 Reply Last reply
    0
  • girishG Offline
    girishG Offline
    girish Staff
    replied to manngobaum on last edited by
    #2

    @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
    0
  • M Offline
    M Offline
    manngobaum
    replied to girish on last edited by
    #3

    @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)"}}
    
    girishG 1 Reply Last reply
    0
  • girishG Offline
    girishG Offline
    girish Staff
    replied to manngobaum on last edited by girish
    #4

    @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
    0
  • M Offline
    M Offline
    manngobaum
    replied to girish on last edited by manngobaum
    #5

    @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)"}}
    
    girishG 1 Reply Last reply
    0
  • girishG Offline
    girishG Offline
    girish Staff
    replied to manngobaum on last edited by
    #6

    @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
    1
  • M Offline
    M Offline
    manngobaum
    replied to girish on last edited by
    #7

    @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
    2

  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Login

  • Don't have an account? Register

  • Login or register to search.