Issue with $request.invokeTemplate() — Unexpected HTTP Method Errors for Ticket Update and Note Addition

Hi,
I’m developing a Freshdesk serverless app using FDK and encountering HTTP method errors when trying to update a ticket and add a note using $request.invokeTemplate().

Error logs:

Ticket update failed: {“message”:“PUT method is not allowed. It should be one of these method(s): GET, POST”}
Adding note failed: {“message”:“POST method is not allowed. It should be one of these method(s): GET, PATCH, PUT, DELETE”}

What I’m doing:

  • Using $request.invokeTemplate() to call templates from requests.json
  • For updating a ticket, I’m using PUT with /api/v2/tickets/{{ticket_id}}
  • For adding a note, I’m using POST with /api/v2/tickets/{{ticket_id}}/notes

Issue:
According to the Freshdesk API documentation, these methods should be allowed:

PUT or PATCH for updating tickets
POST for adding a note

But the response says otherwise.

Question:
Why are the expected HTTP methods being rejected?
Is there a restriction in the serverless app environment or $request.invokeTemplate() that overrides standard API behavior?

Any help or clarification would be appreciated.

THE code may be deprecated,try another way

1 Like