Hello everyone!
I use your nice service in my job for our corporate needs.
So, in integration we tried to show user unread counter by using REST API.
I use the next request on the server-side:
https://my_server.com:7071/home/[user-name]/inbox?fmt=json&query=is:unread
And all works fine untill users have small unread counter.
We found one user who have 12k unread inbox letters and this case kills our server down.
The reason is a very huge response, cuz we get full text of the letter, and a lot of useless information for simple counter.
So, i hope u can help me somehow.
How can i get this info trough REST or SOAP without huge overhead?
Thank you.
REST API unread counter
Re: REST API unread counter
You're probably looking for the GetFolder SOAP Request: https://files.zimbra.com/docs/soap_api/ ... older.html
-
- Posts: 4
- Joined: Tue Nov 07, 2017 10:05 am
Re: REST API unread counter
Hello. Thank you for this link.msquadrat wrote:You're probably looking for the GetFolder SOAP Request: https://files.zimbra.com/docs/soap_api/ ... older.html
But how can i get unread inbox letters for particular user by using this SOAP request?
And i need to have access to info trough any type of username. Real name or alias.
By the way, we can see that this request gives us big overhead too...
Can it really help me somehow?
-
- Posts: 11
- Joined: Fri Jun 09, 2017 4:57 am
Re: REST API unread counter
you can get the unread count in GetFolderResponse:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">
<soapenv:Header>
<urn:context>
<urn:authToken><auth_token_of_user></urn:authToken>
</urn:context>
</soapenv:Header>
<soapenv:Body>
<urn1:GetFolderRequest>
<urn1:folder l="2"/> --2 id of Inbox folder
</urn1:GetFolderRequest>
</soapenv:Body>
</soapenv:Envelope>
<GetFolderResponse xmlns="urn:zimbraMail">
<folder i4ms="11409" rev="1" i4next="1862" f="u" ms="1" deletable="0" l="1" uuid="388e04a0-6e55-43f2-bbca-b069ad7dd9c2" n="79" luuid="116d4141-7fdd-4b23-9d84-ea9dd66d7d2a" activesyncdisabled="0" absFolderPath="/Inbox" view="message" s="303403" u="65" name="Inbox" id="2" webOfflineSyncDays="30"/>
</GetFolderResponse>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">
<soapenv:Header>
<urn:context>
<urn:authToken><auth_token_of_user></urn:authToken>
</urn:context>
</soapenv:Header>
<soapenv:Body>
<urn1:GetFolderRequest>
<urn1:folder l="2"/> --2 id of Inbox folder
</urn1:GetFolderRequest>
</soapenv:Body>
</soapenv:Envelope>
<GetFolderResponse xmlns="urn:zimbraMail">
<folder i4ms="11409" rev="1" i4next="1862" f="u" ms="1" deletable="0" l="1" uuid="388e04a0-6e55-43f2-bbca-b069ad7dd9c2" n="79" luuid="116d4141-7fdd-4b23-9d84-ea9dd66d7d2a" activesyncdisabled="0" absFolderPath="/Inbox" view="message" s="303403" u="65" name="Inbox" id="2" webOfflineSyncDays="30"/>
</GetFolderResponse>
-
- Posts: 4
- Joined: Tue Nov 07, 2017 10:05 am
Re: REST API unread counter
Hello.shrikant-prasad wrote:you can get the unread count in GetFolderResponse:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:zimbra" xmlns:urn1="urn:zimbraMail">
<soapenv:Header>
<urn:context>
<urn:authToken><auth_token_of_user></urn:authToken>
</urn:context>
</soapenv:Header>
<soapenv:Body>
<urn1:GetFolderRequest>
<urn1:folder l="2"/> --2 id of Inbox folder
</urn1:GetFolderRequest>
</soapenv:Body>
</soapenv:Envelope>
<GetFolderResponse xmlns="urn:zimbraMail">
<folder i4ms="11409" rev="1" i4next="1862" f="u" ms="1" deletable="0" l="1" uuid="388e04a0-6e55-43f2-bbca-b069ad7dd9c2" n="79" luuid="116d4141-7fdd-4b23-9d84-ea9dd66d7d2a" activesyncdisabled="0" absFolderPath="/Inbox" view="message" s="303403" u="65" name="Inbox" id="2" webOfflineSyncDays="30"/>
</GetFolderResponse>
Thank you for your post.
This request work nice, but the problem is <auth_token_of_user>.
I cant get it without name and password of user.
When i use the REST API, i can use the admin-account to get info, but for this request if i use admin-account, i get unread counter for admin.
The issue that i try to resolve is taking this counter without user login, by user name, using my admin-account.
Funny then i can take full messaging history by the admin-account, but cant get only counters.
- ccelis5215
- Outstanding Member
- Posts: 632
- Joined: Sat Sep 13, 2014 2:04 am
- Location: Caracas - Venezuela
- ZCS/ZD Version: 8.8.15.GA.3869.UBUNTU18.64 P12
Re: REST API unread counter
Hello, did you trym1nd_killer wrote: Hello.
Thank you for your post.
This request work nice, but the problem is <auth_token_of_user>.
I cant get it without name and password of user.
When i use the REST API, i can use the admin-account to get info, but for this request if i use admin-account, i get unread counter for admin.
The issue that i try to resolve is taking this counter without user login, by user name, using my admin-account.
Funny then i can take full messaging history by the admin-account, but cant get only counters.
Code: Select all
zmsoap -z -m accounttocheck GetFolderRequest
ccelis
-
- Posts: 4
- Joined: Tue Nov 07, 2017 10:05 am
Re: REST API unread counter
Hello everyone.
Thank you for help.
I have found what i needed.
I have fixed my issue by next solution:
1. I get token by AuthRequest with admin-account.
2. I get user-token by DelegateAuthRequest with user-account name.
3. And then i use GetItemRequest with authToken from the 2nd step.
All works fine. Three requests... But it is better than 1st solution.
Thank you, again.
Thank you for help.
I have found what i needed.
I have fixed my issue by next solution:
1. I get token by AuthRequest with admin-account.
2. I get user-token by DelegateAuthRequest with user-account name.
3. And then i use GetItemRequest with authToken from the 2nd step.
All works fine. Three requests... But it is better than 1st solution.
Thank you, again.