Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Пример работы с подсказками DaData на Google Apps Script
function getNameByINN(inn) {
var url = "https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/party";
var query = '{"query": "' + inn + '"}'
var headers = {
"Authorization": "Token ВАШ_API_КЛЮЧ"
};
var fetchArgs = {
method: "POST",
contentType: "application/json",
payload: query,
headers: headers,
muteHttpExceptions: false
};
var response = JSON.parse(UrlFetchApp.fetch(url, fetchArgs));
var party = response.suggestions[0].data;
return {
success: 1,
name: party.name.short_with_opf,
type: party.type,
kpp: party.kpp
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment