Unable to update Service Request custom fields from backend code

Hi Folks,
I am having requirement to update a custom field of Service Request in freshservice portal. I tried this rest api through postman(https://{domain.freshservice.com}/api/v2/tickets/{ticketId}) i am getting 200 status.

But if i am trying the same thing through code i am getting method not allowed error.

FYI i am adding my code snippet here.
var url = https://${FS_domain}/api/v2/tickets/${ticketId};
var headers = {
“Authorization”: Basic <%= encode(iparam.api) %>,
“Content-Type”: “application/json”
var body = {
“description”:“i am anjali”,
var options = {
headers: headers,
body: JSON.stringify(body)
$request.put(url, options).then(function (data) {
}, function (error) {


Hi @Tipuranjali,

Hope you are doing well,

The reason you get this error because $request.put is not a valid HTTP method in terms of Request API, Could you please try the ($request.post) method and let us know if you still get the error?

Hope this helps!

Stay Safe :slight_smile:

Hi @velmurugan,

Thanks for contributing your answer! And I am doing well,hope the same with you.

As you mentioned i tried with post also($request.post) through code but still i am facing issue “Method not allowed”. But in postman i am able to update custom fields successfully using “put” method.

FYI i am uploading the issue i am facing.



Could you check if the endpoint is correct using a console.log() or in the networks tab of the browser, there could be a possibility that ${ticketId} is maybe null/empty and it’s trying to post to api/v2/tickets/ which only supports GET

if the endpoint is correct, please send us the sample payload and the endpoint. So, I can try from my end

Hi @velmurugan,

Could you please let me know how to update a Service Request custom field.


Can anyone help me how to update service request custom field.