Introduction to the Data Export API
Yammer Data Export will package and export all messages (including previous versions), Files stored in Yammer, topics, users, and groups. Data will be exported into a zip file containing .csv files for messages (including previous versions) and additional archives containing Files.
Perform a one-time export simply by specifying the starting date from which you would like to export and the end date to which you would like to export. Alternatively, you can also set up recurring exports on a daily or weekly basis per your business needs.
Highlights
Comprehensive Data Export: Export all the data on your network, including messages (including previous versions), Files, topics, users, and groups. Note: We recommend downloading data with files by using a one-day range, to reduce the likelihood of errors caused by an unreliable data connection. If there are a lot of files on the specified day, we recommend exporting by using a one-hour range.
Data Export API: Utilize the Data Export API to set up and customize automatic, recurring exports for your network. The API provides more control, flexibility, and customization for IT admins.
Simplified One-Time Exports: Simply specify a starting date to have all of your network data from that starting point exported.
For the network on which the external group "lives", export all content in that group.
For the external user that is a group member, VAs only receive threads that the external user explicitly participated in (posted a message to). If there is a message in the group that the user did not participate in, it will not be available in the data export.
Network Data Exports can also be performed by visiting Yammer Network Admin > Content and Security > Export Data.
Authorization
The Data Export API can only be used by Yammer Verified Administrators. An OAuth 2 access token belonging to a verified admin must be used and set as a “Bearer” token in the “Authorization” request header.
The Data Export API supports using both the legacy Yammer OAuth 2 token and Azure Active Directory tokens acquired using MSAL. Learn more about supported authentication types here
GET /api/v1/messages/following.json HTTP/1.1
Host: www.yammer.com
Authorization: Bearer abcDefGhi
For more detail on the “Bearer” token refer to: http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-23
If the access token expires, or the user de-authorizes your app, the API request will return an HTTP 401 with the following error in the body of the response.
{
"response": {
"message": "Token not found.",
"code": 16,
"stat": "fail"
}
}
How this API works
This API is synchronous - an HTTP GET request is made to the API and content is returned in the requested format.
Example Queries
- Export all data since February 9, 2020:
https://www.yammer.com/api/v1/export?since=2020-02-09T00:00:00+00:00
- Export all data since February 9, 2020, and until March 10th, 2021:
https://www.yammer.com/api/v1/export?since=2020-02-09T00:00:00+00:00&until=2021-03-10T00:00:00+00:00
- Export all data since February 9, 2020 but exclude file attachments:
https://www.yammer.com/api/v1/export?since=2020-02-09T00:00:00+00:00&include=csv
- Export message data since February 9, 2020, and exclude file attachments:
https://www.yammer.com/api/v1/export?since=2020-02-9T00:00:00+00:00&model=Message&include=csv
Query Parameters
model: Indicates which models to be exported. All available models will be exported if no model is specified. Multiple models may be specified with multiple parameters with the 'model' name. Available models include:
- User
- Group
- Message
- MessageVersion
- Topic
- Tags
- UploadedFileVersion
- AMAs
- AnswerVote
- Campaigns
- Leader
- LikedMessageHistory
- Sentie
- Topic
- VivaTopic
- VivaTopicApplication
- VivaTopicCurationStateLog
since: (Required parameter) - Indicates the start date of the export. All exported changes will have occurred on or after this date. Must be encoded as an ISO-8601 date.
until: Indicates the end date of the export. All exported changes will have occurred on or before this date (Note: Since export is looking at the until date at 00:00 GMT, use until today+1 if you cannot see the models created on the day of the export). If you're planning on a very large export, use "until" to break up the export into manageable pieces (data exports of a very large size may fail). Must be encoded as an ISO- 8601 date. If this value is not provided, until defaults to the current date.
include: Defines whether to include file attachments or not. Options are ‘csv’ (no attachments) or ‘all’ (include attachments).
network: Which network(s) one wishes to export. Must be accessible using the provided OAuth bearer token. i.e. the network associated with the token, or associated external networks.
include_ens: If ‘true’, automatically include all external networks associated with the network associated with the OAuth bearer token.
Ensure that the parameters are correctly URL encoded before executing the request to the Data Export API. Some tools will handle this automatically, but you should check this when troubleshooting.
API Response
The response is an application/zip (ZIP file) payload encapsulating the contents of the data export. Internally, the ZIP file will contain the following files and directories for a complete export:
- csv files for all or specifically requested models via query parameters
- log.txt
- request.txt
Messages.csv vs MessageVersions.csv
Message export follows these two criteria:
- Exports only versions that fall in the time search range
- If a message is the latest version, it will appear in both Messages.csv and MessageVersions.csv.
MessageVersions.csv
- This means, if the latest version of a message is in the time range, it will be exported in both Messages.csv and MessageVersions.csv; any older version within the time range will only be exported in MessageVersions.csv.
Response CSV Files Contents
The following fields are exported in CSVs in the Data Export API.
File | Content |
---|---|
log.txt | Summary of the export |
request.txt | The parameters of the export |
Admins.csv | A list of current admins, their email addresses, and whether they are a verified admin or a network admin. The CSV file contains the following columns:
|
AMAs.csv | The CSV file contains the following columns:
|
AnswerVotes.csv | The CSV file contains the following columns:
|
Campaigns | The CSV file contains the following columns:
|
Files.csv | For any file added or modified during this date range from Yammer, lists the Yammer ID, type of file, name, description, and path to the file, along with metadata including the group it was posted in. The storage_path column shows whether the file is stored in Yammer or SharePoint. Files.csv does not contain the actual files. Files that are stored in Yammer are exported in their native format to the Files folder of the zip file. Files that are stored in SharePoint are not exported. Files.csv contains the following columns:
|
Groups.csv | For any group created or modified during the specified date range, lists the Yammer ID, name, description, privacy status, whether the group is internal or external, link to the group, who created the group, creation date, and updated date. The CSV file contains the following columns:
|
LikedMessageHistory.csv | Lists all reactions activities on messages from users.Properties included for reactions activity including history:
|
Messages.csv | Lists the messages sent or modified during the selected time period. The CSV file contains the following columns:
|
MessageThreads.csv | The CSV file contains the following columns:
|
MessageThreadOutbound.csv | Includes IDs of external participants in outbound messages. The CSV file contains the following columns:
|
MessageVersions.csv | Includes IDs and modification information for messages that have been edited. The CSV file contains the following columns:
|
Networks.csv | Lists your home network and all external networks included in the export. The CSV file contains the following columns:
|
Sentie.csv | The CSV file contains the following columns:
|
Topics.csv | Lists creation information and a link for any article created during the specified date range. The CSV file contains the following columns:
|
UserGroupRecommendationActions.csv | The CSV file contains the following columns:
|
Users.csv | Lists data for all users who joined, or were deleted or suspended during the specified date range. The CSV file contains the following columns:
|
VivaEngageLeaders.csv | The CSV file contains the following columns:
|
VivaTopicApplications.csv | For any topic applied to a post, lists information about each application for the date range specified (if any). The CSV file contains the following columns:
|
VivaTopicCurationStateLogs.csv | Applies to only Answers in Viva, contains the curation state logs for topics that have been featured. cortex_topic_id can be used in conjunction with the content of VivaTopics.csv to retrieve other information relevant to the topic. The CSV file contains the following columns:
|
VivaTopics.csv | Any topic created or updated is displayed for the date range specified (if any). The id refers to the Viva Topic identifier.The api_url is the URL used to obtain the topic metadata.The CSV file contains the following columns:
|
Potential Failure
If there are errors exporting any data, the data export will be a partial export. In this case, the log.txt will contain details of what failed to export. The best way to avoid partial failures is to export smaller timeframes at a time. Large data exports are more likely to fail.
A Sample Code using the API in Unix and Windows PowerShell is provided here. This Sample Code is provided for the purpose of illustration only and is not intended to be used as-is in a production environment.