Ahmed Hosny
Ahmed Hosny

Reputation: 81

yammer data export using windows code

I try to export data using Data_Export_API_Code_1_Windows

my reference link :

https://developer.yammer.com/docs/data-export-api

I'm using verified admin privilege account

I create .bat file and copy script on it with replace <access token> with admin token and <directory> with directory path where files placed.

and I install wget for windows and update my PATH environment variable to include the GNU bin path.

I'm using windows 10

but when I run .bat it open console and then close it without any change and when I try to run it from cmd it show this image

.bat file execute result on cmd

Upvotes: 0

Views: 435

Answers (1)

Ahmed Hosny
Ahmed Hosny

Reputation: 81

-ca-certificateI discover that the windows code in yammer reference is incorrect and has mistakes. I correct mistakes in code and execute, it run successfully and download the files. the correct code after fixing

@ECHO OFF
SET AT=<OAuth Access Token>
SET DIR=<Export Path>
SET ExportSince=<Datetime in ISO- 8601 like [2016-02-13T00:00:00z]>

cd %DIR%
SETLOCAL EnableDelayedExpansion
::Preform the next export. Send the OAuth 2 access token and store the time of this export in the filename.
SET FILE_NAME=<[myfilename].zip>
SET AUTH_HEADER=Authorization: Bearer %AT%
SET API_URL=https://www.yammer.com/api/v1/export
IF NOT EXIST cacert.pem ( wget http://curl.haxx.se/ca/cacert.pem )
ECHO Downloading..
wget -O %FILE_NAME% -t 1 --header "%AUTH_HEADER%" -ca-certificate cacert.pem %API_URL%?since=%ExportSince%^&include=csv
ECHO Finish Download

Upvotes: 1

Related Questions