I've got an offline timer, and I'm trying to write a script that will take the times and convert them into intervals timers, but I can't get them to pause.
From the API docs, it looks like I need to create the timer and then send a second request to pause it, and 'nullify' the starttime field at the same time, but doesn't document how you 'nullify' a field. I've tried omiting the field, setting it to 'null', setting it to 0, but nothing seems to pause the time.
My pause-a-running-timer XML is
<?xml version="1.0" encoding="UTF-8"?>
<timer>
<personid>12345</personid>
<starttime></starttime>
<time>2700</time>
</timer>
With various values for starttime.
Is there a bug, or am I doing something wrong?
Hey thelem,
First of all, thanks for asking this question. This is a tricky issue and we didn't do a very good job of explaining it. The reason your timers weren't pausing was because getting a true null value in XML is isn't so straightforward.
<starttime>0</starttime> evaluates to the integer zero.
<starttime></starttime> evaluates to a blank string.
To get the system to recognize the starttime field and have it evaluate to null is as follows:
<starttime />
Sorry for the confusion.
In other exciting news, we've created code samples and a PHP class that shows how to create, pause, restart, and delete timers. Hopefully it will be a big help to you. It can be found here:
https://www.myintervals.com/forum/discussion/654/api-php-code-sample-timer-manipulation/
If you have any other questions, please don't hesitate to ask.
Cameron
1 to 2 of 2
Comments are closed.
For more Intervals help documentation, please visit help.myintervals.com