在 Google Data Studio 中连接 apiary.io REST API v1+
Connect apiary.io REST API v1+ in Google Data Studio
我需要将 apiary.io REST API v1+ 连接到 Google Data Studio
。
正如我检查的那样,我需要在 Google Apps Script, as I checked in these tutorials Connect and visualize all your data in Data Studio and External APIs 中开发一个带有 JavaScript
的连接器。
在此逐步软件制造商,piperun REST API v1+。有几个代码片段,但我不能让它们在 GDS
中工作。
不幸的是我对JavaScript
没有太多经验,我的主要技能是T-SQL
,但我可以在Microsoft PowerBI
中成功连接。但是我能够通过插入 URLs
和 TOKENS
访问权限在 Microsoft PowerBI 中成功建立连接,具有 return 代码 200
.
function teste() {
var url = 'https://api.pipe.run/v1/activities';
var request = UrlFetchApp;
request.fetch(url);
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
request.send();
var request = new XMLHttpRequest();
request.open('GET', 'https://api.pipe.run/v1/activities/activity_id');
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Token', 'Q3VydGl1IGVzc2Ugam9iPyEgdHJhYmFsaGVjb25vc2NvQHBpcGUucnVu'); // Here I add TOKEN supplied internally by the application
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
request.send();
}
并且即使输入有效的TOKEN
,也会出现错误:
Failed to request https://api.pipe.run/v1/activities returned code 401. Truncated server response: {"success": false, "message": "Unauthorized"} (use the muteHttpExceptions option to examine the complete answer) (line 8, file "Code")
所以我想帮忙看看是否有另一种简单的方法,或者我需要学习什么才能建立与 apiary.io REST API v1+
的连接。
在朋友开发者的帮助下,我们采用以下方案解决:
function myFunction() {
var token = 'Q3VydGl1IGVzc2Ugam9iPyEgdHJhYmFsaGVjb25vc2NvQHBpcGUucnVu'
var url = 'https://api.pipe.run/v1/deals'
var params = { method:"GET",
headers:{Token: token,
contentType:'application/json',}
};
var response = UrlFetchApp.fetch(url, params);
var json = response.getContentText();
var data = JSON.parse(json);
Logger.log(response.getContentText());
}
我需要将 apiary.io REST API v1+ 连接到 Google Data Studio
。
正如我检查的那样,我需要在 Google Apps Script, as I checked in these tutorials Connect and visualize all your data in Data Studio and External APIs 中开发一个带有 JavaScript
的连接器。
在此逐步软件制造商,piperun REST API v1+。有几个代码片段,但我不能让它们在 GDS
中工作。
不幸的是我对JavaScript
没有太多经验,我的主要技能是T-SQL
,但我可以在Microsoft PowerBI
中成功连接。但是我能够通过插入 URLs
和 TOKENS
访问权限在 Microsoft PowerBI 中成功建立连接,具有 return 代码 200
.
function teste() {
var url = 'https://api.pipe.run/v1/activities';
var request = UrlFetchApp;
request.fetch(url);
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
request.send();
var request = new XMLHttpRequest();
request.open('GET', 'https://api.pipe.run/v1/activities/activity_id');
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Token', 'Q3VydGl1IGVzc2Ugam9iPyEgdHJhYmFsaGVjb25vc2NvQHBpcGUucnVu'); // Here I add TOKEN supplied internally by the application
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
request.send();
}
并且即使输入有效的TOKEN
,也会出现错误:
Failed to request https://api.pipe.run/v1/activities returned code 401. Truncated server response: {"success": false, "message": "Unauthorized"} (use the muteHttpExceptions option to examine the complete answer) (line 8, file "Code")
所以我想帮忙看看是否有另一种简单的方法,或者我需要学习什么才能建立与 apiary.io REST API v1+
的连接。
在朋友开发者的帮助下,我们采用以下方案解决:
function myFunction() {
var token = 'Q3VydGl1IGVzc2Ugam9iPyEgdHJhYmFsaGVjb25vc2NvQHBpcGUucnVu'
var url = 'https://api.pipe.run/v1/deals'
var params = { method:"GET",
headers:{Token: token,
contentType:'application/json',}
};
var response = UrlFetchApp.fetch(url, params);
var json = response.getContentText();
var data = JSON.parse(json);
Logger.log(response.getContentText());
}