PUT operation for metadata does not update group information

Hi,

When updating chat group metadata I am facing the problem that, although my PUT operation succeeds, the old information is not replaced by the updated info.

This is what the metadata of the group is looking prior to the update:

{
   "shipper":[
      {
         "uid":88,
         "name":"John Miller",
         "role":"shipper",
         "companyCode":"SUPPLIER1234AT",
         "companyName":"Supertrans"
      }
   ],
   "supplier":[
      
   ],
   "groupType":"rfx"
}

I want to update some objects within the supplier node array. To do that, I read the existing metadata from the server and replace the supplier node with an updated one.

This is the data, that I send to the server:

{
   "metadata":{
      "shipper":[
         {
            "companyCode":"SUPPLIER1234AT",
            "uid":88,
            "role":"shipper",
            "companyName":"Supertrans",
            "name":"John Miller"
         }
      ],
      "groupType":"rfx",
      "supplier":[
         {
            "companyCode":"Megatrans5432AT",
            "uid":"89",
            "role":"supplier",
            "companyName":"Megatrans Ltd.",
            "name":"Mike Sanders"
         },
         {
            "companyCode":"Megatrans5432AT",
            "uid":"64",
            "role":"supplier",
            "companyName":"Megatrans Ltd.",
            "name":"Rob Howland"
         },
         {
            "companyCode":"Megatrans5432AT",
            "uid":"87",
            "role":"supplier",
            "companyName":"Megatrans Ltd.",
            "name":"Carl Winston"
         },
         {
            "companyCode":"Megatrans5432AT",
            "uid":"89",
            "role":"supplier",
            "companyName":"Megatrans Ltd.",
            "name":"Sam Snaker"
         },
         {
            "companyCode":"Megatrans5432AT",
            "uid":"64",
            "role":"supplier",
            "companyName":"Megatrans Ltd.",
            "name":"Toni Malonie"
         },
         {
            "companyCode":"Megatrans5432AT",
            "uid":"87",
            "role":"supplier",
            "companyName":"Megatrans Ltd.",
            "name":"Robbie Bubble"
         }
      ]
   },
   "name":"myChatroom",
   "guid":"54",
   "type":"private"
}

I send it using Java Spring framework:

`

String response = restTemplate.exchange(URL + “/groups/{guid}” , HttpMethod.PUT, requestEntityMetadata, String.class, chatGroupId).getBody();

`

The response looks like this:

{
   "data":{
      "guid":"54",
      "name":"myChatroom",
      "type":"private",
      "metadata":{
         "shipper":[
            {
               "uid":88,
               "name":"Thomas Gerstenmayer",
               "role":"shipper",
               "companyCode":"SUPPLIERE8866LU",
               "companyName":"SHIPSTA S.\u00e0.r.l."
            }
         ],
         "supplier":[
            
         ],
         "groupType":"rfx"
      },
      "membersCount":4,
      "conversationId":"group_54",
      "createdAt":1648134002,
      "owner":"88",
      "updatedAt":1648159949
   }
}

That means that the updated data was not stored in the group. I’m out of ideas. Is there anyone who can help?

Hello @Dr_Kurt,

We checked this at our end and the API seems to work fine, we were able to update the group with the exact metadata payload shared by you referring to this API:
https://api-explorer.cometchat.com/reference/update-group

Can you please share the cURL request so that we can check this further?

Thank you

1 Like

Hi @siva.nadar ,

Thank you for your response. Is there a private way to provide you with the cURL request? I can’t see functionality to send private messages here…

Hi @Dr_Kurt, You can send us an email with the cURL request at help@cometchat.com.
Please add the link to this forum post and we can continue our support via email.
Thanks and looking forward to your email.

Best,
Paarth Sabharwal
CometChat Customer Success

1 Like

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