I am attempting to create a method to forward a Freshdesk ticket to a specified email address along with an added message. The method and API call work fine, until I add the user_id
property to the body of the API call, and then it fails with a 400 status and the message:
"Unexpected/invalid field in request"
This is unexpected because the Freshdesk API Documentation lists user_id
as a valid field. What am I doing wrong?
The following data has been anonymized, but the anonymized portions are definitely correct.
Here is the response I am getting:
{
"description": "Validation failed",
"errors": [
{
"field": "user_id",
"message": "Unexpected/invalid field in request",
"code": "invalid_field"
}
]
}
Here is the URI I am using:
POST https://{mydomain}.freshdesk.com/api/v2/tickets/118730/forward
My Headers:
Accept: */*
User-Agent: Thunder Client (https://www.thunderclient.com)
Content-Type: application/json
Authorization: Basic {verified key}=:X
And the body of the request:
{
"body": "<p>The workflows for this ticket have been completed: '{workflowNumber}'</p><br><br>",
"user_id": "2043094848729",
"to_emails": ["{me}@{mycompany}.com"]
}
I should also note that this works perfectly when I remove the user_id
from the body of the request, but it fails when user_id
is included, regardless of whether it is in string or int format.
I was able to resolve this issue by using the agent_id
parameter instead of user_id
.