# Export Schedule of a specific date

**URL:** <https://discourse.libretime.org/t/export-schedule-of-a-specific-date/269>\
**Category:** Get Help\
**Created:** [April 2, 2019, 12:40pm UTC](https://discourse.libretime.org/t/export-schedule-of-a-specific-date/269 "2019-04-02T12:40:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nix](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@nix](https://discourse.libretime.org/u/nix)\
**Post date:** [April 2, 2019, 12:40pm UTC](https://discourse.libretime.org/t/export-schedule-of-a-specific-date/269/1 "2019-04-02T12:40:33Z")

</div>

Hello,

I am using the week schedule API `api/week-info/` to display my schedule on a website with success. It is displaying this week and the next week schedule as expected.

I’d like to display the schedule of two specific weeks, is it possible?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![robbt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/robbt/32/15_2.png) [@robbt](https://discourse.libretime.org/u/robbt)\
**Post date:** [April 2, 2019, 2:26pm UTC](https://discourse.libretime.org/t/export-schedule-of-a-specific-date/269/2 "2019-04-02T14:26:36Z")

</div>

Hello nix,  
Welcome to the LibreTime community. Unfortunately our API is currently undocumented for the most part so we need to probe the code to answer this question. This is from airtime\_mvc/application/controllers/ApiController.php there is also a V2 that is used for the embed widget only currently.

```
public function weekInfoAction()
{
    if (Application_Model_Preference::GetAllow3rdPartyApi() || $this->checkAuth()) {
        // disable the view and the layout
        $this->view->layout()->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);

        $request = $this->getRequest();
        $result = WidgetHelper::getWeekInfo($this->getRequest()->getParam("timezone"));

        //used by caller to determine if the airtime they are running or widgets in use is out of date.
        $result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;

        $this->returnJsonOrJsonp($request, $result);
    } else {
        header('HTTP/1.0 401 Unauthorized');
        print _('You are not allowed to access this resource. ');
        exit;
    }
}

```

So lets look and see the functions inside of airtime\_mvc/application/common/WidgetHelper.php

Looking at the V1 code that is used by the API it doesn’t appear to offer any parameters to do anything beyond the current week and next.

Here is the V2 comment

```
/**
 * Returns a weeks worth of shows in UTC, and an info array of the current week's days.
 * Returns an array of two arrays:
 *
 * The first array is 7 consecutive week days, starting with the current day.
 *
 * The second array contains shows scheduled during the 7 week days in the first array.
 * The shows returned in this array are not in any order and are in UTC.
 *
 * We don't do any timezone conversion in this function on purpose. All timezone conversion
 * and show time ordering should be done on the frontend.
 *
 * *** This function does no HTML encoding. It is up to the caller to escape or encode the data appropriately.
 *
 * @return array
 */
public static function getWeekInfoV2()

```

So the quick answer is that this isn’t currently supported.

The long answer is that if you can write and edit PHP code then you could probably add this functionality, a very useful project for LibreTime in general would be to document our API so that we could expand it.

Thanks for asking.

---

<div class="post-metadata">

**Author:** ![nix](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@nix](https://discourse.libretime.org/u/nix)\
**Post date:** [April 2, 2019, 3:01pm UTC](https://discourse.libretime.org/t/export-schedule-of-a-specific-date/269/3 "2019-04-02T15:01:50Z")

</div>

Thanks for your fast and precise answer.  
The first line of the `getWeekInfoV2()` function is

```auto
$weekStartDateTime = new DateTime("now", new DateTimeZone(Application_Model_Preference::GetTimezone()));

```

So even if I’m not very good in php, I can try to modify this function to accept a parameter `$customWeekStartTime` to override `now` if provided.

But then how I can call this function? I don’t really understand where the translation between `api/week-info` and the function `weekInfoAction` is made, and in this case I’d like to add a `api/week-info-v2` url.

Thanks again for your answer, and your work on libretime!

---

<div class="post-metadata">

**Author:** ![robbt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/robbt/32/15_2.png) [@robbt](https://discourse.libretime.org/u/robbt)\
**Post date:** [April 2, 2019, 8:20pm UTC](https://discourse.libretime.org/t/export-schedule-of-a-specific-date/269/4 "2019-04-02T20:20:29Z")

</div>

Well from what I can tell as someone who didn’t write this code and hasn’t spent much time trying to get the API working. The ApiController needs to be updated to point at V2 or better yet a new action working. I think that Zend 1 MVC translates week-info at the top into WeekInfoAction. And I think that it can pull parameters from the requests object.

It extends ZendControllerAction so you might be able to get more info from the docs at [this link](https://framework.zend.com/apidoc/1.12/classes/Zend_Controller_Action.html).

Let me know if that helps I think you just pass the parameters via the URL call. But I need to spend more time figuring this out as right now I’m not 100% sure.

---

<div class="post-metadata">

**Author:** ![nix](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@nix](https://discourse.libretime.org/u/nix)\
**Post date:** [April 2, 2019, 10:43pm UTC](https://discourse.libretime.org/t/export-schedule-of-a-specific-date/269/5 "2019-04-02T22:43:01Z")

</div>

Right. It seems zend is translating `week-info` to an `action` called weekInfoAction() (see [here](https://framework.zend.com/manual/2.3/en/user-guide/routing-and-controllers.html#create-the-controller) for example). So I only need to define a new function named `weekInfoV2Action` that manage the new date param and points well to the `getWeekInfoV2()` and then edit a bit this function …

I will let you know if it works!  
Thanks!

---

<div class="post-metadata">

**Author:** ![nix](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@nix](https://discourse.libretime.org/u/nix)\
**Post date:** [April 3, 2019, 7:54am UTC](https://discourse.libretime.org/t/export-schedule-of-a-specific-date/269/6 "2019-04-03T07:54:41Z")

</div>

Thanks it works as expected!
