office365api - Unexpected responses from Office365 REST API -


we have service fetches emails users using office365 rest api. when user makes call our service:

  1. we first make call messages including attachment metadata, not actual attachment content/bytes.
  2. based on attachment metadata, if content size under threshold, make subsequent calls attachment content.

therefore, our calls following:

  1. get list of messages using get https://outlook.office365.com/api/v1.0/me/folders/inbox/messages/?$expand=attachments($select=id,name,contenttype,size)
  2. for messages need download attachments, invoke get https://outlook.office365.com/api/v1.0/me/messages/{message_id}/attachments api on individual messageids returned in step 1. e.g.:
    • get https://outlook.office365.com/api/v1.0/me/messages/message_id_1/attachments
    • get https://outlook.office365.com/api/v1.0/me/messages/message_id_2/attachments

the problem we're facing users/messages, calls attachments return following error:

{"error":{"code":"errorinvalidattachmentid","message":"the specified attachment id invalid."}}

this failure seems odd since we're not specifying individual attachmentids. messageid must correct since list of messages obtained in step 1. there problem in way we're invoking rest api?

i understand there may possibility attachment available after call messages, no longer available during call attachments. however, we've seen these failures pretty consistently users/messages.

i'd appreciate info unblock situation. thanks!

edit:

here response headers such failure:

transfer-encoding: chunked request-id: eb45663c-e081-4f68-aa99-d4a81fd3ef46 x-calculatedfetarget: bn6pr07cu002.internal.outlook.com x-backendhttpstatus: 400,400 x-feproxyinfo: bn6pr07ca0033.namprd07.prod.outlook.com x-calculatedbetarget: sn2pr03mb2349.namprd03.prod.outlook.com odata-version: 4.0 x-diaginfo: sn2pr03mb2349 x-beserver: sn2pr03mb2349 x-feserver: bn6pr07ca0033,bn3pr16ca0037 cache-control: private date: fri, 11 nov 2016 18:45:06 gmt set-cookie: exchangecookie=33513ff33c354ad0b92a59b852d79b14; path=/ server: microsoft-iis/8.5 x-aspnet-version: 4.0.30319 x-powered-by: asp.net 


Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -