Not signed in (Sign In)

The Intervals Forum

Categories

Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.

API

Creating a paused timer

Bottom of Page

1 to 2 of 2

  1.  
    • CommentAuthorthelem
    • CommentTimeSep 10th 2010
     
    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?
    •  
      CommentAuthorcameron
    • CommentTimeSep 10th 2010 edited @ 09/10/2010 11:49 am
     
    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:

    http://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