{"_id":"547391bf007eb108007e042c","editedParams":true,"version":{"_id":"545137a814af501a00b50cfc","project":"545137a814af501a00b50cf9","__v":11,"createdAt":"2014-10-29T18:53:28.525Z","releaseDate":"2014-10-29T18:53:28.525Z","categories":["545137a814af501a00b50cfd","545138eaa66f020800dbab4a","546b9072b47b5d1400109edf","546b9082b47b5d1400109ee0","546b9088b47b5d1400109ee1","546b909462515a14007ebc43","546b90a0b47b5d1400109ee2","546ced235884600e007a92f6","5481008eea7fd40b00cd7c2b","573b9d83ee2b3b220042291f","57be1efa15efc70e006a5f99"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"user":"5433099f9a2b451a00ad4531","githubsync":"","parentDoc":null,"project":"545137a814af501a00b50cf9","category":{"_id":"546ced235884600e007a92f6","__v":1,"project":"545137a814af501a00b50cf9","pages":["547391bf007eb108007e042c"],"version":"545137a814af501a00b50cfc","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-11-19T19:18:59.863Z","from_sync":false,"order":7,"slug":"data-export-api","title":"Data Export API"},"editedParams2":true,"__v":32,"updates":["55283e3c8962f339009a67be","553ac05f32acc20d00a40111","55c5642d18cd94210075c191","55e624684e60e70d005aae8d","56c441d391b1320d006555cd","570424808572520e00d38e7d","5772900a0a6d610e00de9ef8","57795a4c88c9800e00518f9c","57c08214167729320066d6d3","57d33b88db2574200016ac81","57f97bcf88b8c9200004397d","57fbef5835c9ad0e00ac8a72","581cc538bb096b0f002e61b1","584098a629e3ff0f000d868e","5841c1e3a9032b3900386c96","585833fba507fb2f00fa919f","5887e17f0107ff2300d64588","593875c3682adc00317849e5","594bfa391c0e61000fecbcf8","594bfc1911da36000fb47b96","5b7bc5ba2faa01000324f9a0"],"next":{"pages":[],"description":""},"createdAt":"2014-11-24T20:14:55.587Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"basic_auth":true,"results":{"codes":[]},"settings":"","try":true,"auth":"required","params":[{"_id":"547395b7007eb108007e043f","ref":"","in":"body","required":false,"desc":"Get users data","default":"","type":"mixed","name":"Users"},{"_id":"547395b7007eb108007e043e","ref":"","in":"body","required":false,"desc":"Get group data","default":"","type":"int","name":"Group"},{"_id":"547395b7007eb108007e043d","ref":"","in":"body","required":false,"desc":"Get message data","default":"","type":"int","name":"Message"}],"url":"/export"},"isReference":false,"order":0,"body":"**** Verified Admin Only*\n\nYammer Data Export will package and export **all **messages (including previous versions), Files, 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. You can 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. You can access these settings under Admin > Content and Security > Export Data. Alternatively, you can set up automatic recurring exports by utilizing the Yammer API. The data export is a .zip file that includes:\n\n  * Messages, MessageVersions, Users, Topics, and Groups in separate .CSV files: this contains complete details of each data type, such as message ID, timestamps, participants, group names, etc.\n  \n  * Folders with Files: these will contain Files on your network. Files will be in their native format. Note that exports will only contain Files created or modified during the time period specified for the export.\n\n  * MessageThreads.Outbound.csv: Any external conversations that members of your network participate in in other networks. \n</br>\n\n**Admin Tools – Data Export**\n\nMeet your data warehousing, eDiscovery and compliance needs with Yammer’s Data Export. Data Export packages and exports all messages (including previous versions), Files, topics, users and groups in your network. You can easily set up and create recurring exports using the Yammer Data Export API or download a one-time export from the Admin Tools Interface.\n\n**Highlights**\n\n  * 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.\n\n  * 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.\n  \n  * Simplified One-Time Exports: Simply specify a starting date to have all of your network data from that starting point exported.\n  \n  * Data Retention: Choose between Hard Delete and Soft Delete options to meet your needs. Hard Delete permanently removes data when it is deleted on the network and is recommended for most networks. Soft Delete keeps deleted data visible in data exports.\n\n  * For the network on which the external group \"lives\", we export all content in that group.\n\n  * 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.\n\n\n**Using the Yammer API to Set-up Recurring Exports**\n\nA sample script using the API is provided below in order to ease this transition. On first run, the script will export all network data up from the beginning of the network up until present. From then on, it will automatically check for previous exports, and perform an export from the date of the previous export. This script can be used with common schedulers (Cron, etc) to easily set up recurring exports.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"#!/bin/sh\\n \\nif [! $1 -o ! $2 ]; then\\n  echo \\\"Usage: export.sh <OAuth Access Token> <Directory>\\\"\\n  exit 1\\nfi\\n \\n \\n# Your Yammer OAuth 2 Access Token. This must be a token for a verified admin account.\\nAT=$1\\n \\n# Download location for the export files\\nDIR=$2\\ncd $DIR\\n \\n# Find the last export if there is one. The start date and time of the previous export\\n# is encoded in the filename in UNIX time (http://en.wikipedia.org/wiki/unix_time)\\nLAST_EXPORT=`ls export-*.zip | sed -e 's/export-\\\\(.*\\\\)\\\\.zip/\\\\1/g' | sort -n | tail -l`\\n\\n# Check to see if a previous export was done\\nif [ ! $LAST_EXPORT ]; then\\n  # No previous export was done. Start at the beginning of time (or 1970, which is close enough given Yammer's age).\\n  LAST_EXPORT=0\\nfi\\n \\n# Convert UNIX time to ISO-8601 time, which the API endpoint accepts.\\nDATE=`date -j -r  $LAST_EXPORT \\\"+%Y-%m-%dT%H:%M:%S%z\\\"`\\n \\n# Calculate the current date in UNIX time for the filename of the export.\\nNEXT_EXPORT=`date \\\"+%s\\\"`\\n \\n# Perform the next export. Send the OAuth2 access token and store the UNIX time of this export in the filename.\\ncurl -v --output export-$NEXT_EXPORT.zip \\\\\\n  --header \\\"Authorization: Bearer $AT\\\" \\\\\\n  --get --data-urlencode since=$DATE \\\\\\n  \\\"https://export.yammer.com/api/v1/export\\\"\\n \\n# Verify the download completed\\nif [ $? != 0]; then\\n  echo \\\"Download failed...cleaning up.\\\"\\n  rm export-$NEXT_EXPORT.zip\\n  exit 1\\nfi\\n \\n# Verify the contents of the zip file.\\nunzip -t export-$NEXT_EXPORT.zip >/dev/null 2>&1\\nif [$? != 0 ]; then\\n  echo \\\"Invalid up file detected, export failed....removing downloaded ZIP\\\"\\n  rm export-$NEXT_EXPORT.zip\\n  exit 1\\nfi\\n \",\n      \"language\": \"shell\",\n      \"name\": \"DataExport-PDF-Code\"\n    }\n  ]\n}\n[/block]\n**Authentication:** \n\nOAuth 2 access token, user must be a **verified admin**.\n\n**Query Parameters:**\n\n- access_token – The OAuth bearer token of a verified admin.\n- 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:\n\n  * User\n  \n  * Group\n  \n  * Message\n\n  * MessageVersion  \n \n  * Topic\n  \n  * UploadedFileVersion\n\n- **since** - Indicates the start date of the export. All exported changes will have occurred on or after this date. Must be encoded as an ISO-\n8601 date.\n\n- **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.\n\n- **include** – Defines whether to include file attachments or not. Options are ‘csv’ (no attachments) or ‘all’ (include attachments).\n\n- **network** – Which network(s) one wishes to export. Must be accessible using the provided OAuth bearer token. i.e. the network \nassociated with the token, or associated external networks.\n\n- **include_ens** – If ‘true’, automatically include all external networks associated with the network associated with the OAuth bearer token. \n\nEnsure 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.\n[block:api-header]\n{\n  \"type\": \"basic\"\n}\n[/block]\n**Example Queries: **\n\n- Export all data **since** February 9, 2012:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://export.yammer.com/api/v1/export?since=2012-02-09T00:00:00+00:00&access_token=WOI87382HDL\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nExport all data **since** February 9, 2012 and **until** March 10th, 2012:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://export.yammer.com/api/v1/export?since=2012-02-09T00:00:00+00:00&until=2012-03-10T00:00:00+00:00&access_token=WOI87382HDL\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n\n- - Export all data **since** February 9, 2012 but **exclude file attachments**:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://export.yammer.com/api/v1/export?since=2012-02-09T00:00:00+00:00&include=csv&access_token=WOI87382HDL\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n- Export message data **since** February 9, 2012 and **exclude file attachments**:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://export.yammer.com/api/v1/export?since=2012-02-9T00:00:00+00:00&model=Message&include=csv&access_token=WOI87382HDL\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\n**Response Format**\n\nThe 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:\n\n  *  Users.csv\n  \n  *  Groups.csv\n  \n  *  Messages.csv\n    \n  *  MessageVersions.csv  \n\n  *  Topics.csv\n  \n  *  Files.csv\n  \n  *  files\n  *  186430.pdf\n  *  186433.pptx\n  *  …\n \n  *  Admins.csv\n  \n  *  Networks.csv\n  * log.txt\n  * request.txt \n\n\n**Messages.csv vs MessageVersions.csv**\n\nMessage export follows these two criteria:\n1- Exports only versions that fall in the time search range\n2- If a message is the latest version, it will appear in both Messages.csv and MessageVersions.csv. \n\nThis 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.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"User Columns\",\n    \"h-1\": \"Group Columns\",\n    \"h-2\": \"Message/Message Version Columns\",\n    \"h-3\": \"Topic Columns\",\n    \"0-0\": \"id\\nname\\nemail\\njob_title\\nlocation\\ndepartment\\napi_url\\ndeleted_by_id\\ndeleted_by_type\\njoined_at\\ndeleted_at\\nsuspended_by_id\\nsuspended_by_type\\nsuspended_at\\nguid\\nstate\",\n    \"0-1\": \"id\\nname\\ndescription\\nprivate\\nmoderated\\napi_url\\ncreated_by_id\\ncreated_by_type created_at\\nupdated_at\\ndeleted\\nexternal\",\n    \"0-2\": \"id\\nreplied_to_id\\nthread_id\\nconversation_id\\ngroup_id\\ngroup_name\\nparticipants\\nin_private_group\\nin_private_conversation\\nsender_id\\nsender_type\\nsender_name\\nsender_email\\nbody\\napi_url\\nattachments\\ndeleted_by_id\\ndeleted_by_type\\ncreated_at\\ndeleted_at\",\n    \"0-3\": \"id\\nname\\ncreated_by\\ncreated_at\\napi_url\",\n    \"h-4\": \"File Columns\",\n    \"0-4\": \"id\\nfile_id\\nname\\ndescription\\nuploader_id\\nuploader_type\\ngroup_id\\ngroup_name\\nreverted_to_id\\ndeleted_by_user_id in_private_group\\nin_private_conversation\\nfile_api_url\\ndownload_url\\npath\\nuploaded_at\\ndeleted_at\",\n    \"h-5\": \"\",\n    \"0-5\": \"\",\n    \"h-6\": \"Admin Columns\",\n    \"0-6\": \"id\\nname\\nemail\\nverified\",\n    \"h-7\": \"Network Columns\",\n    \"0-7\": \"id\\npermalink\\nname\\nurl\\npaid\\ncreated_at\\nmoderated\\nusage_policy\\nnumber_of_users\\nsecure_browser_token\"\n  },\n  \"cols\": 8,\n  \"rows\": 1\n}\n[/block]\n\n**Sample Data Export Script for Windows**\n\nA sample script using the API in Windows Command Prompt is provided below for your reference. \nThis sample Code is provided for the purpose of illustration only and is not intended to be used as-is in a production environment.\n\nOn first run, the script will export all network data up from the beginning of the network up until present. From then on, it will automatically check for previous exports, and perform an export from the date of the previous export. This script can be used with Windows schedulers to create automatic, recurring exports.\n\nYou may need to install wget for Windows if you do not already have it installed. Here is a link to the latest version: \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"http://sourceforge.net/projects/gnuwin32/files/wget/1.11.4-1/\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nMake sure to update your PATH environment variable to include the GNU bin path (e.g., C:Program Files (x86)GnuWin32bin).\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \":::at:::ECHO OFF\\n\\nIF [%1]==[ ] (\\n\\tIF [%2]==[ ](\\n\\t\\tECHO \\\"Usage: export.cdm <OAuth Access Token> <Directory>\\\"\\n\\t\\tEXIT /B\\n\\t)\\n)\\n\\n:: Your Yammer Oauth 2 Access Token. This must be a token for a verified admin account. \\nSET AT=%1\\n\\n:: Download location for the export files.\\nSET DIR=%2\\ncd %DIR%\\n\\n:: Find the last export of there is one. The start date and time of the previous export is encoced in the filename \\nSET LAST_EXPORT=0\\nIF EXIST export-*.zip (\\n\\tFOR /f \\\"delims=\\\" %%a in ('dir /B /D export-*.zip') do(\\n\\t\\t:: Use the timestamp from the most recent file\\n\\t\\tSET LAST_EXPORT=%%a\\n  )\\n)\\n\\n:: Remove the relevant parts of the filename so the timestamp can be stored \\nSET LAST_EXPORT=%LAST_EXPORT:export-=%\\nSET LAST_EXPORT=%LAST_EXPORT:.zip=%\\n:: Don't foget the replace the underscore with the colons to ensure correct ISO-8601 formatting\\nSET LAST_EXPORT=%LAST_EXPORT:_=:%\\n\\n:: Calculate the current date in UNIX time for the filename of the export.\\nSET TIME_STAMP=%time:~0,2%:%time:~3,2%:%time:~6,2%z\\nSET NEXT_EXPORT=%date:~10,4%-%date:~4,2%-%date:~7,2%T%TIME_STAMP%\\n:: Make sure to replace \\\":\\\" with \\\"_\\\" so that Windows will save the file\\nSET NEXT_EXPORT=%NEXT_EXPORT::=_%\\n:: Make sure to replace any spaces with 0's. DOS doesn't always provide leading 0's when a time fragment is less than 10\\nSET NEXT_EXPORT=%NEXT_EXPORT: =0%\\n\\n::Preform the next export. Send the OAuth 2 access token and store the time of this export in the filename.\\nSET FILE_NAME=export-%NEXT_EXPORT%.zip\\nSET AUTH_HEADER=Authorization: Bearer %AT%\\nSET API_URL=https://export.yammer.com/api/v1/export\\nIF NOT EXIST cacert.pem ( wget http://curl.haxx.se/ca/cacert.pem )\\n\\nECHO %LAST_EXPORT%\\nwget -o %FILE_NAME% -t 1 --header \\\"%AUTH_HEADER%\\\" -ca-certificate cacert.pem\\n%API_URL%?since=%LAST_EXPORT%\",\n      \"language\": \"text\",\n      \"name\": \"DataExportAPI-Code-1-Windows\"\n    }\n  ]\n}\n[/block]\n\nData Export API Sample Code\nCopyright (c) Microsoft Corporation\nAll rights reserved. \nMIT License\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"\"Software\"\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","excerpt":"","slug":"data-export-api","type":"basic","title":"/export"}
**** Verified Admin Only* Yammer Data Export will package and export **all **messages (including previous versions), Files, 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. You can 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. You can access these settings under Admin > Content and Security > Export Data. Alternatively, you can set up automatic recurring exports by utilizing the Yammer API. The data export is a .zip file that includes: * Messages, MessageVersions, Users, Topics, and Groups in separate .CSV files: this contains complete details of each data type, such as message ID, timestamps, participants, group names, etc. * Folders with Files: these will contain Files on your network. Files will be in their native format. Note that exports will only contain Files created or modified during the time period specified for the export. * MessageThreads.Outbound.csv: Any external conversations that members of your network participate in in other networks. </br> **Admin Tools – Data Export** Meet your data warehousing, eDiscovery and compliance needs with Yammer’s Data Export. Data Export packages and exports all messages (including previous versions), Files, topics, users and groups in your network. You can easily set up and create recurring exports using the Yammer Data Export API or download a one-time export from the Admin Tools Interface. **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. * Data Retention: Choose between Hard Delete and Soft Delete options to meet your needs. Hard Delete permanently removes data when it is deleted on the network and is recommended for most networks. Soft Delete keeps deleted data visible in data exports. * For the network on which the external group "lives", we 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. **Using the Yammer API to Set-up Recurring Exports** A sample script using the API is provided below in order to ease this transition. On first run, the script will export all network data up from the beginning of the network up until present. From then on, it will automatically check for previous exports, and perform an export from the date of the previous export. This script can be used with common schedulers (Cron, etc) to easily set up recurring exports. [block:code] { "codes": [ { "code": "#!/bin/sh\n \nif [! $1 -o ! $2 ]; then\n echo \"Usage: export.sh <OAuth Access Token> <Directory>\"\n exit 1\nfi\n \n \n# Your Yammer OAuth 2 Access Token. This must be a token for a verified admin account.\nAT=$1\n \n# Download location for the export files\nDIR=$2\ncd $DIR\n \n# Find the last export if there is one. The start date and time of the previous export\n# is encoded in the filename in UNIX time (http://en.wikipedia.org/wiki/unix_time)\nLAST_EXPORT=`ls export-*.zip | sed -e 's/export-\\(.*\\)\\.zip/\\1/g' | sort -n | tail -l`\n\n# Check to see if a previous export was done\nif [ ! $LAST_EXPORT ]; then\n # No previous export was done. Start at the beginning of time (or 1970, which is close enough given Yammer's age).\n LAST_EXPORT=0\nfi\n \n# Convert UNIX time to ISO-8601 time, which the API endpoint accepts.\nDATE=`date -j -r $LAST_EXPORT \"+%Y-%m-%dT%H:%M:%S%z\"`\n \n# Calculate the current date in UNIX time for the filename of the export.\nNEXT_EXPORT=`date \"+%s\"`\n \n# Perform the next export. Send the OAuth2 access token and store the UNIX time of this export in the filename.\ncurl -v --output export-$NEXT_EXPORT.zip \\\n --header \"Authorization: Bearer $AT\" \\\n --get --data-urlencode since=$DATE \\\n \"https://export.yammer.com/api/v1/export\"\n \n# Verify the download completed\nif [ $? != 0]; then\n echo \"Download failed...cleaning up.\"\n rm export-$NEXT_EXPORT.zip\n exit 1\nfi\n \n# Verify the contents of the zip file.\nunzip -t export-$NEXT_EXPORT.zip >/dev/null 2>&1\nif [$? != 0 ]; then\n echo \"Invalid up file detected, export failed....removing downloaded ZIP\"\n rm export-$NEXT_EXPORT.zip\n exit 1\nfi\n ", "language": "shell", "name": "DataExport-PDF-Code" } ] } [/block] **Authentication:** OAuth 2 access token, user must be a **verified admin**. **Query Parameters:** - access_token – The OAuth bearer token of a verified admin. - 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 * UploadedFileVersion - **since** - 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. [block:api-header] { "type": "basic" } [/block] **Example Queries: ** - Export all data **since** February 9, 2012: [block:code] { "codes": [ { "code": "https://export.yammer.com/api/v1/export?since=2012-02-09T00:00:00+00:00&access_token=WOI87382HDL", "language": "text" } ] } [/block] Export all data **since** February 9, 2012 and **until** March 10th, 2012: [block:code] { "codes": [ { "code": "https://export.yammer.com/api/v1/export?since=2012-02-09T00:00:00+00:00&until=2012-03-10T00:00:00+00:00&access_token=WOI87382HDL", "language": "text" } ] } [/block] - - Export all data **since** February 9, 2012 but **exclude file attachments**: [block:code] { "codes": [ { "code": "https://export.yammer.com/api/v1/export?since=2012-02-09T00:00:00+00:00&include=csv&access_token=WOI87382HDL", "language": "text" } ] } [/block] - Export message data **since** February 9, 2012 and **exclude file attachments**: [block:code] { "codes": [ { "code": "https://export.yammer.com/api/v1/export?since=2012-02-9T00:00:00+00:00&model=Message&include=csv&access_token=WOI87382HDL", "language": "text" } ] } [/block] **Response Format** 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: * Users.csv * Groups.csv * Messages.csv * MessageVersions.csv * Topics.csv * Files.csv * files * 186430.pdf * 186433.pptx * … * Admins.csv * Networks.csv * log.txt * request.txt **Messages.csv vs MessageVersions.csv** Message export follows these two criteria: 1- Exports only versions that fall in the time search range 2- If a message is the latest version, it will appear in both Messages.csv and 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. [block:parameters] { "data": { "h-0": "User Columns", "h-1": "Group Columns", "h-2": "Message/Message Version Columns", "h-3": "Topic Columns", "0-0": "id\nname\nemail\njob_title\nlocation\ndepartment\napi_url\ndeleted_by_id\ndeleted_by_type\njoined_at\ndeleted_at\nsuspended_by_id\nsuspended_by_type\nsuspended_at\nguid\nstate", "0-1": "id\nname\ndescription\nprivate\nmoderated\napi_url\ncreated_by_id\ncreated_by_type created_at\nupdated_at\ndeleted\nexternal", "0-2": "id\nreplied_to_id\nthread_id\nconversation_id\ngroup_id\ngroup_name\nparticipants\nin_private_group\nin_private_conversation\nsender_id\nsender_type\nsender_name\nsender_email\nbody\napi_url\nattachments\ndeleted_by_id\ndeleted_by_type\ncreated_at\ndeleted_at", "0-3": "id\nname\ncreated_by\ncreated_at\napi_url", "h-4": "File Columns", "0-4": "id\nfile_id\nname\ndescription\nuploader_id\nuploader_type\ngroup_id\ngroup_name\nreverted_to_id\ndeleted_by_user_id in_private_group\nin_private_conversation\nfile_api_url\ndownload_url\npath\nuploaded_at\ndeleted_at", "h-5": "", "0-5": "", "h-6": "Admin Columns", "0-6": "id\nname\nemail\nverified", "h-7": "Network Columns", "0-7": "id\npermalink\nname\nurl\npaid\ncreated_at\nmoderated\nusage_policy\nnumber_of_users\nsecure_browser_token" }, "cols": 8, "rows": 1 } [/block] **Sample Data Export Script for Windows** A sample script using the API in Windows Command Prompt is provided below for your reference. This sample Code is provided for the purpose of illustration only and is not intended to be used as-is in a production environment. On first run, the script will export all network data up from the beginning of the network up until present. From then on, it will automatically check for previous exports, and perform an export from the date of the previous export. This script can be used with Windows schedulers to create automatic, recurring exports. You may need to install wget for Windows if you do not already have it installed. Here is a link to the latest version: [block:code] { "codes": [ { "code": "http://sourceforge.net/projects/gnuwin32/files/wget/1.11.4-1/", "language": "text" } ] } [/block] Make sure to update your PATH environment variable to include the GNU bin path (e.g., C:Program Files (x86)GnuWin32bin). [block:code] { "codes": [ { "code": "@ECHO OFF\n\nIF [%1]==[ ] (\n\tIF [%2]==[ ](\n\t\tECHO \"Usage: export.cdm <OAuth Access Token> <Directory>\"\n\t\tEXIT /B\n\t)\n)\n\n:: Your Yammer Oauth 2 Access Token. This must be a token for a verified admin account. \nSET AT=%1\n\n:: Download location for the export files.\nSET DIR=%2\ncd %DIR%\n\n:: Find the last export of there is one. The start date and time of the previous export is encoced in the filename \nSET LAST_EXPORT=0\nIF EXIST export-*.zip (\n\tFOR /f \"delims=\" %%a in ('dir /B /D export-*.zip') do(\n\t\t:: Use the timestamp from the most recent file\n\t\tSET LAST_EXPORT=%%a\n )\n)\n\n:: Remove the relevant parts of the filename so the timestamp can be stored \nSET LAST_EXPORT=%LAST_EXPORT:export-=%\nSET LAST_EXPORT=%LAST_EXPORT:.zip=%\n:: Don't foget the replace the underscore with the colons to ensure correct ISO-8601 formatting\nSET LAST_EXPORT=%LAST_EXPORT:_=:%\n\n:: Calculate the current date in UNIX time for the filename of the export.\nSET TIME_STAMP=%time:~0,2%:%time:~3,2%:%time:~6,2%z\nSET NEXT_EXPORT=%date:~10,4%-%date:~4,2%-%date:~7,2%T%TIME_STAMP%\n:: Make sure to replace \":\" with \"_\" so that Windows will save the file\nSET NEXT_EXPORT=%NEXT_EXPORT::=_%\n:: Make sure to replace any spaces with 0's. DOS doesn't always provide leading 0's when a time fragment is less than 10\nSET NEXT_EXPORT=%NEXT_EXPORT: =0%\n\n::Preform the next export. Send the OAuth 2 access token and store the time of this export in the filename.\nSET FILE_NAME=export-%NEXT_EXPORT%.zip\nSET AUTH_HEADER=Authorization: Bearer %AT%\nSET API_URL=https://export.yammer.com/api/v1/export\nIF NOT EXIST cacert.pem ( wget http://curl.haxx.se/ca/cacert.pem )\n\nECHO %LAST_EXPORT%\nwget -o %FILE_NAME% -t 1 --header \"%AUTH_HEADER%\" -ca-certificate cacert.pem\n%API_URL%?since=%LAST_EXPORT%", "language": "text", "name": "DataExportAPI-Code-1-Windows" } ] } [/block] Data Export API Sample Code Copyright (c) Microsoft Corporation All rights reserved. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.