我一直在阅读这个地方的点点滴滴尝试进入API的东西一段时间(诚然,几乎所有事情都超出了我),找到this帖子,我能够链接我们的 Pipedrive 加入Google表格,但是当我尝试使用以数字开头的自定义字段API密钥时,它似乎绊倒了?
即。似乎偶然发现了数据的推动.132 ......(从第7行开始)
任何线索/指针都将不胜感激!
// Standard functions to call the spreadsheet sheet and activesheet
function GetPipedriveDeals() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var sheet = ss.getActiveSheet();
//the way the url is build next step is to iterate between the end because api only allows a fixed number of calls (100) this way i can slowly fill the sheet.
var url = "https://api.pipedrive.com/v1/deals:(org_name,title,owner_name,status,pipeline_id,value,a4f55810dfde1c6bead0709c5e0362a693e1a737,132c9a542e33bb3a2af984585eab85a0ee95b708)?start=";
var limit = "&limit=500";
var filter = "&filter_id=64";
var pipeline = 1; // put a pipeline id specific to your PipeDrive setup
var start = 0;
// var end = start+50;
var token = "&api_token=YOUR_API_TOKEN"
//call the api and fill dataAll with the jsonparse.
//then the information is set into the
//dataSet so that i can refill datall with new data.
var response = UrlFetchApp.fetch(url+start+limit+filter+token);
var dataAll = JSON.parse(response.getContentText());
var dataSet = dataAll;
//create array where the data should be put
var rows = [], data;
for (var i = 0; i < dataSet.data.length; i++) {
data = dataSet.data[i];
if(data.pipeline_id === pipeline){
rows.push([data.title, data.org_name, data.owner_name, data.status, data.pipeline_id, data.a4f55810dfde1c6bead0709c5e0362a693e1a737, data.value, data.132c9a542e33bb3a2af984585eab85a0ee95b708]);//your JSON entities here
}
}
Logger.log( JSON.stringify(rows,null,2) ); // Log transformed data
return rows;
}
&#13;
答案 0 :(得分:1)
Pipedrive工程师在这里。我认为你有javascript对象属性引用问题 - 它不能以数字开头。尝试:
rows.push([data.title, data.org_name, data.owner_name, data.status, data.pipeline_id, data['a4f55810dfde1c6bead0709c5e0362a693e1a737'], data.value, data['132c9a542e33bb3a2af984585eab85a0ee95b708']]);//your JSON entities here