Api: Time Spent in wrong format

Hello,

Setting up an app to export “time spent” via API from Freshdesk. The issue is that the format is a missmatch. The documentation states HH:mm but I can only retrive it in seconds.

Documentation wrong, or is there a way to choose format?

Hi @Octopus,

Are you using the REST API Time Entries endpoint or using one of the onTimeEntry* product events in a Freshdesk app?

I tested the REST API, and I get back the time_entry field in “hh:mm” format.

Hello @kaustavdm

Thank you, I missed to inform about that - I do use “onTimeEntryCreateCallback”.
That sends the information via api to Microsoft Logic to connect to other applications we use.

I’ve tested via postman as you described, and then the information comes out as hh:mm correctly.

Thanks. I can’t reproduce this in local simulation. Let me try testing it as a Custom App.

Can you let me know what FDK version and Platform version are you on?

  • For FDK version, run: $ fdk version
  • For Platform version, see the value of "platform-version" field in manifest.json
1 Like

This would be part of my serverless app.

info.
“platform-version”: “2.0”

% fdk version
Installed: 6.13.2

@Octopus, apologies for the delay. Are you still facing this issue?

I could not reproduce this using a custom app. I still get time_spent as hh:mm for onTimeEntryCreate event.

@kaustavdm Hello,

No worries, Im glad for all the input I can get. So thank you!
When it comes to my “time-in-seconds” issue it is still there.

If I use postman as you do in the screenshot I can “get” the time correctly in hh:mm
My serverless app that sends it in seconds. If you take a quick look at my screnshot form earlier, am I missing something? Ive tested with and without “” but the issue is the same.

I know Im doeing something wrong, can not figure out what.

Hello @kaustavdm

Could I ask you a favor, could you send me the small app you made as a test?
Would like to see what I am missing.

I have sent the sample code in a DM.

If possible, can you share only the event handler code for onTimeCreate (minus any credentials or sensitive information) in the same DM thread? That way I can take a look and see if anything is going wrong in the serialization and deserialization process.

I’ll also confirm with our product team to see if they have seen similar issues.

2 Likes

At the moment, this is not announced yet. But it is a good practice to start migrating your apps to platform version 2.2 whenever possible.

1 Like

You mean learn new things I know nothing about today :slight_smile:

@Octopus,

So, I finally got in touch with the product team, and looks like there actually are a few inconsistencies between documented behaviour and actual behaviour. Seems like some other people in the team are able to reproduce your issue. Finally. :slight_smile:

Going ahead the outcomes can be either of:

  • If the product team tells us this is a bug (time_entry.time_spent should be hh:mm formatted string), then the documented behaviour will continue once fixes are in place, and you will have to update your code to treat the field as a formatted string
  • If they tell us this is the intended outcome (number instead of hh:mm formatted string), then we will have to update our docs and how FDK behaves in local simulation, and your code will work as it is doing now.

I will keep you posted on the updates as I receive them.


Re: fdk 7 update, if your current app code works properly under fdk 6, updating to fdk 7 will mainly involve installing fdk 7, and running fdk validate on your code. (I recommend opening a new thread if you get stuck with fdk 7 migration)

1 Like

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