Reputation: 9822
I am using the gmail API to list threads, and I'm finding that some of the items that come back from users_threads->list
cannot be found using users_threads->get
. These items also cannot be seen via gmail's web UI.
I am using gmail's api explorer (https://developers.google.com/gmail/api/v1/reference/users/threads/list) to test listing threads.
My inbox is empty for the auth'd account.
The site makes a request like GET https://www.googleapis.com/gmail/v1/users/me/threads?labelIds=INBOX&key={YOUR_API_KEY}
and returns this result set:
200 OK
cache-control: no-cache, no-store, max-age=0, must-revalidate
content-encoding: gzip
content-length: 287
content-type: application/json; charset=UTF-8
date: Wed, 08 Jul 2015 18:23:25 GMT
etag: "A_TI-e9NgLq0wln5q88xm3zdvSg/6meEdFVG8voZD7dqGr76UTURSRk"
expires: Fri, 01 Jan 1990 00:00:00 GMT
pragma: no-cache
server: GSE
vary: Origin, X-Origin
{
"threads": [
{
"id": "14a78517c954ec9c",
"snippet": "",
"historyId": "806722"
},
{
"id": "149daea953d5674e",
"snippet": "",
"historyId": "688170"
},
{
"id": "149d462f26b543db",
"snippet": "",
"historyId": "686319"
},
{
"id": "149ac0958a5b44e8",
"snippet": "",
"historyId": "657008"
},
{
"id": "149ac0c2caea09f7",
"snippet": "",
"historyId": "656272"
},
{
"id": "149ac08d36ce3087",
"snippet": "",
"historyId": "656263"
},
{
"id": "148e3ab2c048f49e",
"snippet": "",
"historyId": "491569"
},
{
"id": "147a123d780d44a7",
"snippet": "",
"historyId": "186314"
},
{
"id": "1478f8b6c004dddb",
"snippet": "",
"historyId": "178535"
},
{
"id": "1478cf683ca0dc8d",
"snippet": "",
"historyId": "177603"
},
{
"id": "14788aa2aba1f35a",
"snippet": "",
"historyId": "173433"
}
],
"resultSizeEstimate": 11
}
It seems to return 11
objects when I would expect 0
.
Furthermore, if I use the threads->get
api (https://developers.google.com/gmail/api/v1/reference/users/threads/get) on any of these items, I get the following response:
GET https://www.googleapis.com/gmail/v1/users/me/threads/1478cf683ca0dc8d?key={YOUR_API_KEY}
404 Not Found
cache-control: private, max-age=0
content-encoding: gzip
content-length: 120
content-type: application/json; charset=UTF-8
date: Wed, 08 Jul 2015 18:30:21 GMT
expires: Wed, 08 Jul 2015 18:30:21 GMT
server: GSE
vary: Origin, X-Origin
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Not Found"
}
],
"code": 404,
"message": "Not Found"
}
}
There seems to be a bug in the API. According to the support page I am supposed to direct all concerns to stackoverflow, using the gmail-api
tag, which I have done.
If the consensus here at stackoverflow is that this is a product bug, I will submit an issue with the product team as I could not find any similar bug submitted yet.
Thanks for any help addressing this issue.
Upvotes: 4
Views: 672
Reputation: 1524
Its not a bug in API. threads.list() would return you all the email threads including the ones which have been deleted. You must be getting the 404 on the messages which have been deleted. If a message has been permanently deleted, it will still show up in threads.list() call and message.get() call will fail on such messages.
Hope this clears some air.
Upvotes: 5