RESTful knowledge exchange
Post Reply
twesterd
Influencer
Posts: 17
Liked: 3 times
Joined: May 17, 2017 7:38 pm
Full Name: Trevor W
Contact:

XML Schema Mismatch- TimeOffsetUtc

Post by twesterd » May 21, 2017 6:16 pm 1 person likes this post

When I look at the example documentation: https://helpcenter.veeam.com/docs/backu ... tml?ver=95

There is a mismatch between the example and the actual XML I get via the API. The example uses a <Time> element within the actual XML returned is a <TimeOffsetUtc> element (see below).

Within the example documentation... this is what I expect returned:

Code: Select all

   <OptionsDaily Enabled="true">
     <Kind>Everyday</Kind>
     <Days>Sunday</Days>
     <Days>Monday</Days>
     <Days>Tuesday</Days>
     <Days>Wednesday</Days>
     <Days>Thursday</Days>
     <Days>Friday</Days>
     <Days>Saturday</Days>
     <Time>22:00:00.0000000-07:00</Time>
   </OptionsDaily>
In the actual XML returned via my API, this is what I receive:

Code: Select all

      <OptionsDaily Enabled="true">
      <Kind>Everyday</Kind>
      <Days>Sunday</Days>
      <Days>Monday</Days>
      <Days>Tuesday</Days>
      <Days>Wednesday</Days>
      <Days>Thursday</Days>
      <Days>Friday</Days>
      <Days>Saturday</Days>
      <TimeOffsetUtc>65700</TimeOffsetUtc>
    </OptionsDaily>
Why am I getting the element "TimeOffsetUtc" rather than "Time"? One is easy to change and populate (Time) and the other (TimeOffsetUtc) requires conversion from some unknown base point in time and knowledge of what each integer value represents (ticks, seconds, minutes, etc.).

I need to change the time jobs start via the API and this is really confusing. I want the Time element as the documentation shows, not the TimeOffsetUtc (royal pain). Is there a way to get the correct element (Time) returned in the XML and/or how to I convert values (need to know base point in time and what each integer value represents)?

twesterd
Influencer
Posts: 17
Liked: 3 times
Joined: May 17, 2017 7:38 pm
Full Name: Trevor W
Contact:

Re: XML Schema Mismatch- TimeOffsetUtc

Post by twesterd » May 21, 2017 6:54 pm 1 person likes this post

Okay I debugged the actual .NET object (JobEntityType) autogenerated via the supplied XSD and discovered both elements are there with flags for whether they are used or not. Apparently, TimeOffsetUtc is enabled/used by default. Time is disabled by default; thus, its not returned in the XML.

TimeOffsetUTc's base point in time is 12:00:00 AM and the integer values are seconds. So if someone wants the job to start at 6:00 PM, that would be 18 hours after 12:00:00 AM, or 18 * 60 * 60 = 64,800 seconds.

To use Time vs TimeOffsetUtc turn the Time flag on (job.JobScheduleOptions.OptionsDaily.TimeSpecified = true), turn TimeOffsetUtc off (job.JobScheduleOptions.OptionsDaily.TimeOffsetUtcSpecified = false) and set its value accordingly.

To use TimeOffsetUtc just know its time is based in seconds after 12:00:00 AM (not nearly as bad as I originally thought).

twesterd
Influencer
Posts: 17
Liked: 3 times
Joined: May 17, 2017 7:38 pm
Full Name: Trevor W
Contact:

Re: XML Schema Mismatch- TimeOffsetUtc

Post by twesterd » May 22, 2017 4:34 am 1 person likes this post

Okay, this is the behavior I notice:

1) I always get the time in UTC format and its always marked true.
2) If I try to post in UTC format, nothing happens, its ignored
3) If I change to the Time format, and set UTC to false, I can post the new time and it works... BUT back to point #1, the next time I get the time, its back in UTC

Just the way it goes I guess... a bit weird

Mardock
Influencer
Posts: 20
Liked: never
Joined: Jul 10, 2014 3:40 pm
Contact:

[MERGED] How to change the daily scheduled time of a backup job via REST API

Post by Mardock » Nov 21, 2018 2:21 pm

Hi,
I must change the daily scheduled time of a backup job so I edit the job via Veeam REST API services.

I make a PUT to URL http://<Enterprise-Manager>:9399/api/jobs/{ID}?action=edit
The OptionDaily section is the following:

Code: Select all

<OptionsDaily Enabled="true">
  <Kind>Everyday</Kind>
  <Days>Sunday</Days>
  <Days>Monday</Days>
  <Days>Tuesday</Days>
  <Days>Wednesday</Days>
  <Days>Thursday</Days>
  <Days>Friday</Days>
  <Days>Saturday</Days>
  <TimeOffsetUtc>79200</TimeOffsetUtc>
  <Time>22:00:00.0000000+01:00</Time>
</OptionsDaily>
The daily scheduled time of the job is always set to 00:00 independently of the values of elements TimeOffsetUtc and Time.

Also I noticed that if I make a GET http://<Enterprise-Manager>:9399/api/jobs/{ID}?format=Entity than the OptionDaily section
has only the attribute TimeOffsetUtc.

According to the veeam documentation (https://helpcenter.veeam.com/docs/backu ... tml?ver=95) the OptionDaily section must have only the attribute Time

I'm a bit confused about that.

Do you have any ideas how to change the daily scheduled time of a backup job via REST API?


Thank you.
Mardock

PTide
Veeam Software
Posts: 4540
Liked: 371 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: XML Schema Mismatch- TimeOffsetUtc

Post by PTide » Nov 21, 2018 9:00 pm

Hi Mardock,

I think you might find some hints in this thread where our fellow user has done a good job finding a workaround.

P.S. The issue has been reported.

Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest