'在日历组中创建日历' Outlook API端点因“错误无效”和“错误信息”而失败。错误

时间:2018-03-08 19:50:26

标签: python microsoft-graph office365api outlook-api

在日历组中创建日历' Outlook API端点最近(在过去几周内)在我目前正在处理的多租户应用程序中停止工作。

以下是使用Python shell的问题的再现:

import api

>>> url = "https://outlook.office.com/api/v2.0/users/auser@adomain.com/calendargroups"
>>> response = api.get(url)
>>> response
[{
    u'ClassId': u'bf22395d-e505-4f58-8504-6e6e8ef8c3c7', 
    u'Name': u'My Calendar Group', 
    u'ChangeKey': u'g4QAQQ9PZUGX1I2OsM9/LgAAA0km+g==', 
    u'@odata.id': u"https://outlook.office.com/api/v2.0/Users('46560569-3535-441e-9bcf-eb093a992360@767316c0-7a9b-4a7c-95e9-5490466be3f0')/CalendarGroups('AAMkAGVmNzJkNGNiLWE4YmYtNDQ2NC1iOGJiLWI5ZmFlYzgyNzVmYgBGAAAAAAC3biJFdLv_S7D_aGLbIKWwBwCDhABBD09lQZfUjU6wz38uAAAAAAEGAACDhABBD09lQZfUjU6wz38uAAADSL12AAA=')", 
    u'Id': u'AAMkAGVmNzJkNGNiLWE4YmYtNDQ2NC1iOGJiLWI5ZmFlYzgyNzVmYgBGAAAAAAC3biJFdLv_S7D_aGLbIKWwBwCDhABBD09lQZfUjU6wz38uAAAAAAEGAACDhABBD09lQZfUjU6wz38uAAADSL12AAA='
}]


>>> calendargroup_id = response[0]['Id']
>>> url += "/%s/calendars" % calendargroup_id
>>> url
"https://outlook.office.com/api/v2.0/users/auser@adomain.com/calendargroups/AAMkAGVmNzJkNGNiLWE4YmYtNDQ2NC1iOGJiLWI5ZmFlYzgyNzVmYgBGAAAAAAC3biJFdLv_S7D_aGLbIKWwBwCDhABBD09lQZfUjU6wz38uAAAAAAEGAACDhABBD09lQZfUjU6wz38uAAADSL12AAA=/calendars"

>>> api.get(url) // This API call succeeds. It successfully tells us that this calendargroup contains no calendars. In other words it is able to identify the calendargroup using the calendargroup_id we send it.
[]

>>> api.post(url, data={'Name': 'New Calendar'}) // This is the failing API call. If we try to do a POST request in order to create a new calendar, the API can no longer parse our id, and complains:
{u'error': {u'message': u'Id is malformed.', u'code': u'ErrorInvalidIdMalformed'}}

我已确认Microsoft Graph和Outlook API端点上都会发生此错误。

我认为这可能与在API端点上进行的base64解码类型有关,因为我能够通过替换' _'的所有实例来使API工作。用' +'在其中一个ids。如果ID包含' - '此解决方法不起作用。字符,在这种情况下,我找不到错误。

我们正在使用许多其他端点来创建事件,日历组和订阅,并且它们都正常工作。只有这个端点才能给我们带来麻烦。

有关如何解决此错误的任何想法?

0 个答案:

没有答案