Freshservice API "Validation failed" for field "body"

Hi together,

I guess that’s a pretty simple question, but I just can’t get it to work.

I want to make a simple API call to a ticket which adds a comment /note.
This is my call (POST):
https://<mycompany>.freshservice.com/api/v2/tickets/<tickernumber>/notes

My JSON:
{ "body":"Hi tom, Still Angry" }

The response:

 {
        "description": "Validation failed",
        "errors": [
            {
                "field": "body",
                "message": "Unexpected/invalid field in request",
                "code": "invalid_field"
            }
        ]
    }

I hope someone sees the mistake I am making.

Kind Regards,
Erik

Hi @efeise ,

Welcome to Freshworks Developer Community :bouquet: :fireworks:

I believe you are referring to Conversation API to add note to a ticket. The API expects data to be in form-data format.

Here is an example of the same.

  1. For a private note
curl --location --request POST 'https://<domain>.freshservice.com/api/v2/tickets/<ticket_id>/notes' \
--header 'Authorization: Basic <auth_details>' \
--form 'body="Hi Tom, I am still angry"' \
  1. For a public note
curl --location --request POST 'https://<domain>.freshservice.com/api/v2/tickets/<ticket_id>/notes' \
--header 'Authorization: Basic <auth_details>' \
--form 'body="Hi Tom, I am still angry"' \
--form 'private="false"'

Regards,
Thakur

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