0

我正在努力将我现有的应用程序与 Graph API 集成。使用 Outlook API,我们能够创建“日历 webhook”和“日历事件 webhook”。根据文档,日历事件 webhookSubscriptionresource_type me/events. 是否有任何修饰符可以缩小到日历 ID?此外,有没有办法订阅正在添加或删除的日历?

我试过me/events/{id},,,,me/events/me/calendars/{id}/events无济于事/me/calendars/{id}

API_BASE = 'https://graph.microsoft.com/v1.0'

def api_url(fmt, *args, **kwargs):
    """Helper for generating API URLs"""
    return API_BASE + fmt.format(*args, **kwargs)


def _create_push_subscription(self, callback_url):
    """Create a push subscription"""

    expiration = now() + timedelta(days=2)

    # Initialize some parameters
    data = {
        'resource': '/me/calendars/{}/events'.format(calendar_id),
        'subscriptionExpirationDateTime': str(expiration.isoformat()).replace('+00:00', 'Z'),
        'changeType': 'created,deleted,updated',
        'notificationURL': callback_url,
    }

    # Create the subscription
    resp = self.session.post(api_url('/subscriptions'), json=data)

    # Return the channel ID and expiration date
    return parse_datetime(resp['subscriptionExpirationDateTime'])

我得到的唯一回应503 (Gateway timeouts)

400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/subscriptions
4

1 回答 1

1
于 2019-06-17T21:28:29.640 回答