Skip to main content

Hello,

 

I’m attempting to use the API to update a requester, of which I have been able to pull the information for with no problem. Unfortunately, when following the examples listed in the API documentation, I am entirely unable to get the sample code to work when supplying my own data.

 

The example listed in the API documentation for updating a requester is:

curl -v -u api_key:X -H 'Content-Type: application/json' -X PUT -d '{ "first_name":"Ronald", "last_name":"Weasley","time_format":"24h" }' 'https://domain.freshservice.com/api/v2/requesters/888'

 

I am modifying this command as such:

curl.exe -u "$($ApiKey):x" -H 'Content-Type: application/json' -X PUT -d '{ "first_name":"First","last_name":"Last","time_format":"12h" }' 'https://domain.freshservice.com/api/v2/requesters/01234567891'

 

When I execute this request, I receive the error:

Status: 400

{"code":"missing_params","message":"Your update call does not have any parameter. Atleast one parameter is required."}

 

I can confirm that the requester user ID I am providing is an existing user, and I am able to retrieve information using a “GET” request, but have been unable to update the user information using a “PUT” request.

 

Does anyone have any idea why this is happening? I don’t see any practical difference between what I am doing and what is listed in the documentation.

For the record, support was entirely unable to assist me with this issue, but I was able to track down what was going wrong.

 

I was using curl via Powershell, which requires all double quotes contained inside single quotes to be escaped with a backslash (‘ \”for example\” ’).


For the record, support was entirely unable to assist me with this issue, but I was able to track down what was going wrong.

 

I was using curl via Powershell, which requires all double quotes contained inside single quotes to be escaped with a backslash (‘ \”for example\” ’).

thanks for updating. Out of interest, are you automating a bulk import of requester details with all their metadata?  Mind me asking a bit more of how you achieved it if so?


thanks for updating. Out of interest, are you automating a bulk import of requester details with all their metadata?  Mind me asking a bit more of how you achieved it if so?

Hi BigCarlD,

 

No problem. Yeah, that’s pretty much the situation; I needed to supply the Reporting Manager field to each of our users for approval automations.

 

I was provided a CSV list of each user, their emails and their manager’s names. I made a Powershell script that looped through the provided CSV, retrieved the Freshservice user ID for each user and then appended the ID to a new column. Afterwards, it would loop through again and for each user it would look up their Reporting Manager’s Freshservice ID and add the Reporting Manager to the original user using an API call.

I’m leaving some stuff out that I had to do for general cleanup (different calls for requesters and agents) and error handling. It’s also worth noting that Freshservice has a rate limit on the amount of API calls you can make per minute, so I had to build sleep timers into my API call functions. I have some links below to documentation that might help you locate some more info.

Rate Limit: https://api.freshservice.com/#rate_limit

Requester Attributes: https://api.freshservice.com/#requester_attributes

Agent Attributes: https://api.freshservice.com/#agent_attributes


exactly my use case, reporting manager. Thanks for responding, that is really really helpful.

 

I’m investigating the idea of having Zapier catch a webhook when our HR system updates an employee record, so the API call to update Fresh is only done for occasional changes, rather than being done en-masse on a schedule.  I’m very new to API queries and such though, but it’s fun learning.


Haha, awesome I’m glad I was able to help! That’s a great idea, we’re looking at doing something similar with our HR system too. Good luck on your API journey!


Thanks for all the insights @volcanicdove :).

 

PS - This was marked under the Freshdesk forum, I’ve just moved it to Freshservice - Community folks, please do mark the right product category to get timely help.


Reply