Menu

API core/update public_log

Alexey
2024-10-08
2024-10-08
  • Alexey

    Alexey - 2024-10-08

    Hi, I have a problem with adding a public_log from API.
    When I'm try to add a comment this way - it's empty and it remove all my previous comments.
    my json_data from request :

    {    
    "operation": "core/update",
    "class": "UserRequest",
    "key": "114",
    "comment":"test",
    "fields": {       
     "title": "Test Title Update",
            "public_log": {
                "items": [
                    {
                        "add_entry": {
                            "message": "This is a comment with a title update.",
                             "user_login": "Admin123456"
                       }
                    }
                ]
            }
        }
     }
    

    in response, in 'public_log' section I get that :

                    "public_log": {
                        "entries": [
                            {
                                "date": "2024-10-08 09:54:49",
                                "user_login": "Admin Admin",
                                "user_id": "1",
                                "message": "",
                                "message_html": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<?xml encoding=\"UTF-8\"?>\n"
                            }
                        ]
                    }
    

    However, I have a bunch of comments added from Customer Portal and Ticket as well

    Can you please give me an example of adding public_logs via API?

    ITOP v3.2.0-2-14758

     

    Last edit: Alexey 2024-10-08
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2024-10-08

    https://www.itophub.io/wiki/page?id=latest:advancedtopics:rest_json

    Where did you see "add_entry" ? I see "add_item" ?

     
    • Alexey

      Alexey - 2024-10-08

      Yeah, you're right, it's "add_item", but it doesn't affect to comment creation. I got the same issue.
      my actual json_data :

      {    
      "operation": "core/update",
          "class": "UserRequest",
          "key": "114",
      "comment":"test",
          "fields": {       
       "title": "Test Title Update",
              "public_log": {
                  "items": [
                      {
                          "add_item": {
      "date": "2024-10-08 10:10:10","message": "This is a comment with a title update.",
      "user_login": "Admin123456"
                         }
                      }
      
                  ]
              }
          }}
      

      and the same response :

                     "public_log": {
                          "entries": [
                              {
                                  "date": "2024-10-08 11:11:44",
                                  "user_login": "Admin Admin",
                                  "user_id": "1",
                                  "message": "",
                                  "message_html": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<?xml encoding=\"UTF-8\"?>\n"
                              }
                          ]
                      }
      
       
      • Jeffrey Bostoen

        Jeffrey Bostoen - 2024-10-08

        Mind that your structure is still incorrect. There shouldn't be "items", just "add_item" directly ;)

         
        • Alexey

          Alexey - 2024-10-08

          wow, thank you! now it works =)

           
          👍
          1

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.