REST API - Action StartTime/EndTime

I’ve been looking the action part of the “REST” API recently. I can’t seem to get a hold of the StartTime or EndTime of an action.

Whenever I use GET /api/action/{id}, I do get the following information:

<HasStartTime>false</HasStartTime>
<HasEndTime>true</HasEndTime>

That’s all very nice to know, but I can’t seem to find a single action where it does actually list a Start or Endtime. I looked at the .xsd’s, and I saw the following:

<xs:element name="HasTimeRange" type="xs:boolean" minOccurs="0" />
<xs:element name="TimeRange" minOccurs="0">
   <xs:complexType>
      <xs:sequence>
         <xs:element    name="StartTime" type="xs:time" minOccurs="0" />
         <xs:element    name="EndTime" type="xs:time" minOccurs="0"    />
      </xs:sequence>
   </xs:complexType>
</xs:element>

So I’m concluding that the StartTime and EndTime elements are enclosed in the TimeRange element, and the TimeRange element does not have to appear.
Also I guess I’ll conclude that the TimeRange element only appears if

<HasTimeRange>true</HasTimeRange>.

Possibly HasTimeRange is only true when ?

<HasStartTime>true</HasStartTime>
<HasEndTime>true</HasEndTime>

Most of the actions I have do NOT have a StartTime (they start on creation), so they do NOT have a TimeRange.
So how would I retrieve the EndTime for these actions?

What you’re looking for is this:

<EndDateTimeLocalOffset>P3DT22H</EndDateTimeLocalOffset>

Only god knows why it’s formatted that way but that is the value for an action that ends in 3 days and 22 hours

This is the value for an action that ends in two days:

<EndDateTimeLocalOffset>P2D</EndDateTimeLocalOffset>

And this is the value for an action that ends in four days, three hours, two minutes, and one second

<EndDateTimeLocalOffset>P4DT3H2M1S</EndDateTimeLocalOffset>

I dont see anything related to the issue time returned from the API so you might need another session relevance statement like:

time issued of bes action whose (id of it = <actionid>)

And on that note you can probably just use:

(end date of it, end time_of_day of it) of bes action whose (id of it = <actionid>)

Instead of pulling the action itself

Ah, that is indeed what I’m looking for! Thanks a bunch. There was no in hell I would have noticed that EndDateTimeLocalOffset was a date :smile:

Look at this related post about how to create the Start/End times formatted that way: