Java API do Bazy Internetowej REGON
http://bip.stat.gov.pl/dzialalnosc-statystyki-publicznej/rejestr-regon/interfejsyapi/
Java
public class Main {
private static final String GUS_NIP = "5261040828";
private static final String INVALID_NIP = "1261040828";
public static void main(String[] args) throws IOException {
try (final Connection connection = BIR1.createNewTestConnection()) {
final ValueHandler valueHandler = connection.getValue();
System.out.println("Service status: " + valueHandler.getServiceStatus());
System.out.println("Session status: " + valueHandler.getSessionStatus());
final DataHandler dataHandler = connection.findData();
final Company company = dataHandler.getDataByNip(GUS_NIP).orElse(null);
System.out.println("Found company: " + company.getName());
final Company invalid = dataHandler.getDataByNip(INVALID_NIP).orElse(null);
System.out.println("Invalid: " + invalid);
System.out.println("Last message code: " + valueHandler.getMessageCode());
System.out.println("Last message: " + valueHandler.getMessageContent());
final ReportHandler reportHandler = connection.getReport();
String fullReport = reportHandler.getFullReport(company.getRegon(), ReportType.PublDaneRaportPrawna)
.orElse(null);
System.out.println("Full report:\n" + fullReport);
}
}
}