咨询Yammer API获取全公司群组消息的正确请求格式及示例
I’ve run into this exact issue before—using 0 as the group ID for the All Company group doesn’t work because Yammer doesn’t actually use 0 as a valid ID for that group. Here’s how to correctly pull those messages:
Option 1: Use the Actual All Company Group ID
First, you need to retrieve the real group ID for your network’s All Company group:
- Send a GET request to:
https://www.yammer.com/api/v1/groups.json?network_id=Default - In the JSON response, look for the group with the name
All Company(or your network’s localized equivalent, like "全公司" for Chinese). Grab theidvalue from that entry—it’ll be a positive integer, similar to the118*******ID you used for your other group.
Once you have that ID, construct your request just like you did for the specific group:
https://www.yammer.com/api/v1/messages/in_group/{ALL_COMPANY_GROUP_ID}.json?network_id=Default&newer_than=408119030538240
Replace {ALL_COMPANY_GROUP_ID} with the actual ID you pulled from the groups endpoint. This will return the same structured JSON response you get from your working group request.
Option 2: Use the Company Feed Endpoint (No Group ID Needed)
If you don’t want to fetch the group ID first, Yammer has a dedicated parameter to pull the company-wide feed directly:
- Send a GET request to:
https://www.yammer.com/api/v1/messages.json?feed_type=company&network_id=Default&newer_than=408119030538240
The feed_type=company parameter tells the API to return all messages visible across your entire network, which is exactly what the All Company group includes.
Why 0 Doesn’t Work
Yammer assigns unique positive integer IDs to all groups, including the All Company group. 0 isn’t a valid group ID in their system, so the API doesn’t recognize that request and throws an error instead of returning the expected messages.
内容的提问来源于stack exchange,提问作者Dmitri Vorobev

