Я пытаюсь использовать эту таблицу:
https://kennymcnett.com/domain-name-checker-in-google-sheets/
Я получил ключ API от RapidAPI.
Однако я получаю следующее сообщение об ошибке:
Exception: DNS error: https://domainr.p.mashape.com/v2/status?mashape-key=f23.....25c5&domain=undefined (line 30, file "Code")
Строка 30 расширения:
var result = UrlFetchApp.fetch(url+domain);
Весь код в расширении:
// Works as of April 6, 2016
// domainr docs: http://domainr.build/docs/overview
// Get your free API key from https://market.mashape.com/domainr/domainr
// Create an application, get a key
// Put your key into the cell on the "Instructions" sheet
/* sample return JSON from domainr.p.mashape.com
*
* https://domainr.p.mashape.com/v2/status?mashape-key=YOURKEYHERE&domain=testasfkljhsdf.com
*
* Produces:
*
* {"status":[{"domain":"testasfkljhsdf.com","zone":"com","status":"undelegated inactive","summary":"inactive"}]}
*
*/
function domainLookup(domain) {
if (domain == "") {
return "N/A";
}
//Get the Key from cell A11 on the sheet named "Key"
var key = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Instructions').getRange('key').getValue(); //range = named range of the cell with the API key in it
//Submit to mashape
var url = "https://domainr.p.mashape.com/v2/status?mashape-key=" + key + "&domain=";
var result = UrlFetchApp.fetch(url+domain);
var out = JSON.parse(result.getContentText());
var answer = out.status[0].summary;
//Interpret the answer
if (answer == 'undelegated' || answer == 'inactive') {
var finalAnswer = "Available";
} else {
var finalAnswer = "Nope";
}
//Logger.log(out);
//Logger.log(finalAnswer);
//Show the answer
return finalAnswer;
}
Это инструкции в электронной таблице:
For more detailed instructions and other information about this document, see the write-up:
http://kennymcnett.com/domain-name-checker-in-google-sheets/
Instructions
Step 1
Make a copy of this document into your own Google Drive. Then, don't change anything on this sheet except the API Key
Step 2
Get a domainr.com API key from mashape.com
Step 3
Paste your domainr API key from mashape.com below:
f236......................................b0725c5
Step 4
Go to the Domain Names sheet and have fun!
Bonus
If you want to see the script code, go to "Tools > Script editor..."For more detailed instructions and other information about this document, see the write-up:
http://kennymcnett.com/domain-name-checker-in-google-sheets/
Instructions
Step 1
Make a copy of this document into your own Google Drive. Then, don't change anything on this sheet except the API Key
Step 2
Get a domainr.com API key from mashape.com
Step 3
Paste your domainr API key from mashape.com below:
f236.........................................25c5
Step 4
Go to the Domain Names sheet and have fun!
Bonus
If you want to see the script code, go to "Tools > Script editor..."
Изменить: удалось решить эту ошибку, изменив URL-адрес на:
domainr.p.rapidapi.com
Однако после этого я получаю новое сообщение об ошибке:
Exception: Request failed for domainr.p.rapidapi.com returned code 403. Truncated server response: {"message":"You are not subscribed to this API."} (use muteHttpExceptions option to examine full response) (line 30).
Что я сделал до сих пор: 1. Убедитесь, что API, который я использую, является бесплатный API. Согласно этому URL-адресу поддомен, который я использую, предназначен для бесплатной версии этого api:
https://domainr.p.rapidapi.com (free or non-commercial use)
source: https://domainr.com/docs/api
Я подтвердил, что мне не нужно вводить данные моей кредитной карты для доступа к бесплатным API. Согласно этой документации, бесплатные api не требуют от меня ввода информации о кредитной карте в мою учетную запись RapidAPI. `
`
БЕСПЛАТНЫЕ API-интерфейсы
RapidAPI имеет тысячи БЕСПЛАТНЫХ API-интерфейсов. Как следует из названия, вы можете попробовать любой из этих API без указания данных кредитной карты. Эти API-интерфейсы четко обозначены как БЕСПЛАТНЫЕ.
? Требуемый сторонний ключ API
Иногда вам необходимо получить ключ API или токен с веб-сайта поставщика.
`
source: https://docs.rapidapi.com/docs/api-pricing