Custom Object Update not working in Freshdesk

Trying to perform CRUD operations on a FreshDesk Custom Object. Having a challenge with Update Freshdesk. The error message is looking for an update to version, but it’s not in the documentation. Tried sending version:2 in the payload, but it didn’t work:

VERBOSE: Performing the operation "Set-FreshdeskCustomObjectRecord" on target "https://itsfine.freshdesk.com/api/v2/custom_objects/schemas/3724685/records/_0-4".
VERBOSE: Appending Authorization header
VERBOSE: Invoke-FreshworksRestMethod - Initiating REST API call to https://itsfine.freshdesk.com/api/v2/custom_objects/schemas/3724685/records/_0-4 with API key:  XXXXXXX
VERBOSE: Invoke-FreshworksRestMethod - REST call parameters:
VERBOSE: Invoke-FreshworksRestMethod - Uri:  https://itsfine.freshdesk.com/api/v2/custom_objects/schemas/3724685/records/_0-4
VERBOSE: Invoke-FreshworksRestMethod - ContentType:  application/json; charset=utf-8
VERBOSE: Invoke-FreshworksRestMethod - UseBasicParsing:  True
VERBOSE: Invoke-FreshworksRestMethod - ErrorAction:  Stop
VERBOSE: Invoke-FreshworksRestMethod - Method:  PUT
VERBOSE: Invoke-FreshworksRestMethod - Headers:
VERBOSE: Invoke-FreshworksRestMethod - Accept-Charset:  utf-8
VERBOSE: Invoke-FreshworksRestMethod - Authorization:  Basic XXXXXXX
VERBOSE: Invoke-FreshworksRestMethod - Body:  {
  "data": {
    "date": "2024-03-21"
  },
  "display_id": "_0-4"
}
VERBOSE: Invoke-FreshworksRestMethod - Invoking REST PUT Method on https://itsfine.freshdesk.com/api/v2/custom_objects/schemas/3724685/records/_0-4...
VERBOSE: Invoke-FreshworksRestMethod - Forcing TLS 1.2 protocol for invoking REST method.
VERBOSE: Requested HTTP/1.1 PUT with 73-byte payload
VERBOSE: Received HTTP/1.1 response of content type application/json of unknown size
VERBOSE: Catching exception Microsoft.PowerShell.Commands.HttpResponseException with status code                        
VERBOSE: Throwing Default exception of type Microsoft.PowerShell.Commands.HttpResponseException
Invoke-WebRequest: C:\Build\FreshdeskPS\FreshdeskPS\Private\Invoke-FreshworksRestMethod.ps1:191:28
Line |
 191 |                  $results = Invoke-WebRequest @restParams
     |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     |  {   "error_type": "INVALID_INPUT",   "message": "Invalid input",   "errors": [     {       "type": "record",       "name": "version",       "message": "Version information is missing in the record"     }   ] }
PS C:\Build\FreshdeskPS>
PS C:\Build\FreshdeskPS> Get-FDCustomObjectRecord -custom_object_id 3724685 -record_id '_0-4'
                                                                                                                        
display_id   : _0-4
created_time : 1710893851213
updated_time : 1710893851213
data         : @{date=2024-03-19; name=Test2}
version      : 1
metadata     : @{primary_field_name=name}
_links       : @{self=}

There is a version property in the schema, but nothing about it in the docs. Anyone that provide guidance? The payload matches the documentation, so hoping someone has solved this.

@Freddy your thoughts on this?

Hello! It seems that you’re encountering an issue with updating a custom object record in Freshdesk due to missing version information. Since the error message states “Version information is missing in the record,” you need to include the version information in the payload.

You mentioned that you tried adding version:2 in the payload, but it didn’t work. In this case, you should use the existing version returned from the Get-FDCustomObjectRecord operation. In the example you provided, the version is 1.

Please modify the payload as follows:

{
  "data": {
    "date": "2024-03-21"
  },
  "display_id": "_0-4",
  "version": "1"
}

If you still encounter the same issue, please let us know, and we’ll help investigate further.

Hi @rasimm,

As it is not in the documentation, I have raised a support ticket (#15757411) on your behalf to check if it’s a bug or a documentation miss.

Please respond to the support ticket response email thread if more information is requested.

I will post the summary from the support ticket here and update the documentation accordingly if required.

@Gopi Freddy doesn’t have the Freshworks products API context yet. We will add them as soon as possible.

Hi @Raviraj

Will say that it’s a bit of an odd payload. The requirement is you are sending a PUT on the object record in the URL (e.g. api/v2/custom_objects/schemas/3724685/records/_0-4). Then additionally, you need to send the ID in the payload again what the display_id is and the current version. The goal is to update record _0_4, why do we need to then tell it the display_id again and a specific version of the record? That requires that you do GET first. Also, noticed that if you try to create a record and it exists based on the primary key, it just tells you that it exists rather than telling you what the ID is. If it’s telling you a record exists, why not have context like what the conflicting display_id is. Just some general observations working on the custom object CRUD.