Проверка ИНН API
DaData.ru
Подключение и простой поиск:
<html> <head> <link href="https://cdn.jsdelivr.net/jquery.suggestions/16.8/css/suggestions.css" type="text/css" rel="stylesheet"/> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <!--[if lt IE 10]> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.1/jquery.xdomainrequest.min.js"></script> <![endif]--> <script type="text/javascript" src="https://cdn.jsdelivr.net/jquery.suggestions/16.8/js/jquery.suggestions.min.js"></script> </head> <body> <input id="party" name="party" type="text" size="100"/> <script type="text/javascript"> $("#party").suggestions({ serviceUrl:"https://suggestions.dadata.ru/suggestions/api/4_1/rs", token:"---", type:"PARTY", count:5, onSelect:function(suggestion){ console.log(suggestion); } }); </script> </body> </html>
Разложить организацию по полям:
<html> <head> <link href="https://cdn.jsdelivr.net/jquery.suggestions/16.8/css/suggestions.css" type="text/css" rel="stylesheet"/> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <!--[if lt IE 10]> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ajaxtransport-xdomainrequest/1.0.1/jquery.xdomainrequest.min.js"></script> <![endif]--> <script type="text/javascript" src="https://cdn.jsdelivr.net/jquery.suggestions/16.8/js/jquery.suggestions.min.js"></script> </head> <body> <section class="container"> <h1>Подсказки по организациям и ИП</h1> <input id="party" name="party" type="text" placeholder="Введите название, ИНН, ОГРН или адрес организации"/> </section> <section class="result"> <p id="type"></p> <div class="row"> <label>Краткое наименование</label> <input id="name_short"/> </div> <div class="row"> <label>Полное наименование</label> <input id="name_full"/> </div> <div class="row"> <label>ИНН / КПП</label> <input id="inn_kpp"/> </div> <div class="row"> <label>Адрес</label> <input id="address"/> </div> </section> <script> function join(arr){ var separator=arguments.length>1?arguments[1]:", "; return arr.filter(function(n){return n}).join(separator); } function typeDescription(type){ var TYPES={ 'INDIVIDUAL':'Индивидуальный предприниматель', 'LEGAL':'Организация' } return TYPES[type]; } function showSuggestion(suggestion){ console.log(suggestion); var data=suggestion.data; if(!data)return; $("#type").text( typeDescription(data.type)+" ("+data.type+")" ); if(data.name)$("#name_short").val(join([data.opf&&data.opf.short||"",data.name.short||data.name.full]," ")); if(data.name&&data.name.full)$("#name_full").val(join([data.opf&&data.opf.full||"",data.name.full]," ")); $("#inn_kpp").val(join([data.inn, data.kpp]," / ")); if(data.address)$("#address").val(data.address.value); } $("#party").suggestions({ serviceUrl:"https://suggestions.dadata.ru/suggestions/api/4_1/rs", token:"---", type:"PARTY", count:5, onSelect:showSuggestion }); </script> </body> </html>
Подробнее:
Подключение: https://dadata.ru/suggestions/usage/#party
REST API: https://dadata.ru/api/suggest/#request-party
Как разложить компанию по полям? Наименование, ИНН, КПП, адрес? http://codepen.io/dadata/pen/Gdakz?editors=1010
Еще по теме:
https://www.nalog.ru/rn77/service/egrip2/
http://sc-kontur.ru/focus/focus_api