使用Windows代码导出yammer数据

时间:2016-01-27 07:09:07

标签: windows batch-file yammer

我尝试使用Data_Export_API_Code_1_Windows

导出数据

我的参考链接:

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

我使用的是经过验证的管理员权限帐户

我在其上创建.bat文件并复制脚本,将<directory>替换为管理员令牌,将// create and set up the audio session AVAudioSession* audioSession = [AVAudioSession sharedInstance]; [audioSession setDelegate:self]; [audioSession setCategory: AVAudioSessionCategoryPlayAndRecord error: nil]; [audioSession setActive: YES error: nil]; // set up for bluetooth microphone input UInt32 allowBluetoothInput = 1; OSStatus stat = AudioSessionSetProperty ( kAudioSessionProperty_OverrideCategoryEnableBluetoothInput, sizeof (allowBluetoothInput), &allowBluetoothInput ); NSLog(@"status = %x", stat); // problem if this is not zero // check the audio route UInt32 size = sizeof(CFStringRef); CFStringRef route; OSStatus result = AudioSessionGetProperty(kAudioSessionProperty_AudioRoute, &size, &route); NSLog(@"route = %@", route); // if bluetooth headset connected, should be "HeadsetBT" // if not connected, will be "ReceiverAndMicrophone" // now, play a quick sound we put in the bundle (bomb.wav) CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef soundFileURLRef; SystemSoundID soundFileObject; soundFileURLRef = CFBundleCopyResourceURL (mainBundle,CFSTR ("bomb"),CFSTR ("wav"),NULL); AudioServicesCreateSystemSoundID (soundFileURLRef,&soundFileObject); AudioServicesPlaySystemSound (soundFileObject); 替换为放置文件的目录路径。

我安装wget for windows并更新我的PATH环境变量以包含GNU bin路径。

我正在使用Windows 10

但是当我运行.bat它打开控制台然后关闭它而没有任何改变,当我尝试从cmd运行它时显示此图像

.bat file execute result on cmd

1 个答案:

答案 0 :(得分:1)

-ca-certificateI发现yammer引用中的windows代码不正确并且有错误。 我纠正代码中的错误并执行,它运行成功并下载文件。 修复后的正确代码

@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