hapiを使ってNodeJSのgoogle apiに問題があります。私はnpmでgoogleapisとgoogle-auth-libraryをインストールしてファイルをダウンロードしました。すべてが正しくセットアップされています。NodeJS&googleapis、POSTリクエストが機能していませんか?
function listData(auth) {
let webmasters = google.webmasters('v3');
webmasters.searchanalytics.query({
auth: auth,
siteUrl: 'http%3A%2F%2Falanmroczek.pl%2F',
startDate: "2016-09-20",
endDate: "2016-10-14"
}, function(err, response) {
if (err) {
console.log('The API returned an error: ' + err);
return;
}
console.log(response);
});
}
私はこのアプリケーションでこの範囲に許可されています(エラーが発生しない場合は、この部分が無効であると確信しています)。私はGmailのフォルダのリストを完了したとき、それは完全に動作します。コードやgoogleapisのこの部分だけが間違っている可能性があります。通常のGETのように、私がなぜ分からない
protocol: 'https:',
slashes: true,
auth: null,
host: 'www.googleapis.com',
port: null,
hostname: 'www.googleapis.com',
hash: null,
search: '?startDate=2016-09-20&endDate=2016-10-14',
query: 'startDate=2016-09-20&endDate=2016-10-14',
pathname: '/webmasters/v3/sites/http%3A%2F%2Falanmroczek.pl%2F/searchAnalytics/query',
path: '/webmasters/v3/sites/http%3A%2F%2Falanmroczek.pl%2F/searchAnalytics/query?startDate=2016-09-20&endDate=2016-10-14',
href: 'https://www.googleapis.com/webmasters/v3/sites/http%3A%2F%2Falanmroczek.pl%2F/searchAnalytics/query?startDate=2016-09-20&endDate=2016-10-14' },
クエリー、パスとのhrefルックス:
私は、GoogleのAPIにリクエストをCONSOLE.LOGする場合:私にとっては奇妙であることです。私はそれを無効にしようとしましたが、私はまだ "バックエンドのエラー"を取得します。
EDIT:GET経由のGmailリストフォルダです。なぜPOSTを指摘したのですか。
Search Console APIを使用しています –