KiCompany en: Difference between revisions

From services.krediidiinfo.ee
Jump to navigation Jump to search
No edit summary
No edit summary
 
(7 intermediate revisions by 3 users not shown)
Line 11: Line 11:
KiCompany WDSL is located at  [http://services.krediidiinfo.ee/KiCompany.wsdl http://services.krediidiinfo.ee/KiCompany.wsdl].
KiCompany WDSL is located at  [http://services.krediidiinfo.ee/KiCompany.wsdl http://services.krediidiinfo.ee/KiCompany.wsdl].


WSDL for users of Microsoft Development Tools is located at: [http://services.krediidiinfo.ee/KiCompanyLit.wsdl http://services.krediidiinfo.ee/KiCompanyLit.wsdl]. It differs from the previous WSDL in that '''RPC/litteral''' is used instead of '''RPC/encode'''.  
WSDL for users of Microsoft Development Tools is located at: [http://services.krediidiinfo.ee/KiCompanyLit.wsdl http://services.krediidiinfo.ee/KiCompanyLit.wsdl]. It differs from the previous WSDL in that '''RPC/litteral''' is used instead of '''RPC/encode'''.
 
.NET core development tools compatible wsdl is located at: http://services.krediidiinfo.ee/KiCompanyNetCore.wsdl, url: https://services.krediidiinfo.ee/soap.php?name=KiCompany&ver=NetCore
 
= Testing =
 
In short KiCompany testrequests require the relevant permission and adding "debug" parameter to the URL (https://services.krediidiinfo.ee/soap.php?name=KiCompany -> https://services.krediidiinfo.ee/soap.php?name=KiCompany&debug). More and detailed information about testing can be found on the http://services.krediidiinfo.ee/wiki/index.php/Web_Service_Debugging page.


= Methods =  
= Methods =  
Line 50: Line 56:
|-
|-
| <b>Input parameter:</b>  
| <b>Input parameter:</b>  
| regCode
| name
| xs:string
| xs:string
| Company’s registry code
| Company’s name or the beginning of it. Inserting % at the start will search the existence of that string anywhere in the company's name. NB! Search with % can be considerably slower.
|-
|-
| <b></b>  
| <b></b>  
Line 81: Line 87:
| Company’s name.
| Company’s name.
|}
|}


== getBasicData ==
== getBasicData ==
Line 185: Line 189:
| activities  
| activities  
| xs:string
| xs:string
| The list of company’s activities. Before every activity there is a string '* ' (asterisk and space). From 7/29/2011 the activity information is available only by special agreement. If there is no agreement, an empty string will be given as a result.  
| The list of company’s activities. Before every activity there is a string '* ' (asterisk and space). From 7/29/2011 an empty string will be given as a result.  
|-
|-
| status
| status
Line 192: Line 196:
|-
|-
|}
|}


== getContactData ==
== getContactData ==
Line 258: Line 260:
== getLegalPostAddress ==
== getLegalPostAddress ==


Ettevõtte juriidilise aadressi pärimine.
Requesting company’s legal post address.


{| style="border-style: solid; border-width: 1px;"
{| style="border-style: solid; border-width: 1px;"
!  
!  
! Nimi
! Name
! Tüüp
! Type
! Kirjeldus
! Description
|-
|-
| <b>Sisendparameetrid:</b>  
| <b>Input parameters:</b>  
| regCode
| regCode
| xs:string
| xs:string
| ettevõtte äriregistri kood.
| company’s registry code.
|-
|-
| <b>Väljundparameeter:</b>
| <b>Output parameter:</b>
| data
| data
| CompanyPostAddressType
| CompanyPostAddressType
| kirje juriidilise aadressi andmetega
| A record with legal address data
|}
|}


Kui ''regCode''-ile vastavat ettevõtet ei leita, siis tagastatakse SOAP veateade koodiga -10231.
If the company according '''regCode''' is not found, the SOAP error message code -10231 will be returned.


CompanyPostAddressType tüüpi kirje on järgmise struktuuriga:
CompanyPostAddressType record is with the following structure:


{| style="border-style: solid; border-width: 1px;"
{| style="border-style: solid; border-width: 1px;"
! Nimi
! Name
! Tüüp
! Type
! Kirjeldus
! Description
|-
|-
| street
| street
| xs:string
| xs:string
| tänava nimi
| street name 
|-
|-
| postCode
| postCode
| xs:string
| xs:string
| indeks
| postcode
|-
|-
| city
| city
| xs:string
| xs:string
| linn
| city
|}
|}


Line 303: Line 305:
== isRegCodeValid ==
== isRegCodeValid ==


Ettevõtte äriregistri korrektsuse kontrollimine.  
Verification of company’s registry code.  


{| style="border-style: solid; border-width: 1px;"
{| style="border-style: solid; border-width: 1px;"
!  
!  
! Nimi
! Name
! Tüüp
! Type
! Kirjeldus
! Description
|-
|-
| <b>Sisendparameetrid:</b>  
| <b>Input parameter:</b>  
| regCode
| regCode
| xs:string
| xs:string
| Ettevõtte äriregistri kood
| Company’s registry code
|-
|-
| <b>Väljundparameeter:</b>
| <b>Output parameter:</b>
| isValid
| isValid
| xs:boolean
| xs:boolean
| Tõene, kui parameetriga ette antud äriregistri kood on kaheksakohaline arv ja viimane kontrollnumber on õige.
| True if registry code given with parameter is an eight-digit number and the last check digit is correct.
|}
|}




== getVATNo ==
== getVATNo ==


Ettevõtte käibemaksukohustuslase numbri pärimine.
Requesting company’s VAT number .


{| style="border-style: solid; border-width: 1px;"
{| style="border-style: solid; border-width: 1px;"
!  
!  
! Nimi
! Name
! Tüüp
! Type
! Kirjeldus
! Description
|-
|-
| <b>Sisendparameetrid:</b>  
| <b>Input parameter:</b>  
| regCode
| regCode
| xs:string
| xs:string
| Ettevõtte äriregistri kood.
| Company’s registry code.
|-
|-
| <b>Väljundparameeter:</b>
| <b>Output parameter:</b>
| vatNo
| vatNo
| xs:string
| xs:string
| KMK number. Kui KMK number ei kehti või ettevõte ei ole käibemaksukohuslane, siis tagastatakse tühistring
| VAT number. If VAT number is not valid or the company is not VAT pager, an empty string will be given.
|}
|}




= Veakoodid =
= Error codes =




== -10231 No company found! ==
== -10231 No company found! ==


Krediidiinfo andmebaasist ei leitud parameetriga ette antud registrikoodile vastavat ettevõtet. Kontrollida registrikoodi.
No company found with the registry code given for parameter from Creditinfo’s database. Check the registry code.
 
(see more [[Veakoodid_en|general error codes]])
 


(vt lisaks [[Veakoodid|üldiseid veakoode]])


= Programmi näidis PHP-s =
= Example in PHP =


Järgnevalt on toodud PHP-s kirjutatud KiCompany veebiteenuse kasutamise näide.
Example of using KiCompany web service in PHP.


<pre>
<pre>
<?php
<?php
/**
/**
  * Example of using KiCompany web service of Krediidiinfo AS
  * Example of using KiCompany web service of Creditinfo Eesti AS
  *  
  *  
  * @author Rait Kapp <rait@krediidiinfo.ee>
  * @author Rait Kapp <rait@creditinfo.ee>
  * @created 15.02.2011
  * @created 15.02.2011
  */
  */
Line 371: Line 377:


$params = array('location' => $server_url
$params = array('location' => $server_url
               , 'login'        => 'online_code' // Online Code issued by Krediidiinfo client management. Make sure that login value is string type (PHP bug?).
               , 'login'        => 'online_code' // Online Code issued by Creditinfo client management. Make sure that login value is string type (PHP bug?).
               , 'password'      => 'passwd'
               , 'password'      => 'passwd'
//              , 'proxy_host'    => 'cache.neti.ee'  // If necessary use proxy and proxy port.
//              , 'proxy_host'    => 'cache.neti.ee'  // If necessary use proxy and proxy port.
Line 388: Line 394:
$regCode = '10256137';
$regCode = '10256137';
$name = $client->getName($regCode);
$name = $client->getName($regCode);
echo "Äriregistri kood {$regCode} kuulub ettevõttele {$name}\n";
echo "Registry code {$regCode} belongs to the company {$name}\n";


$data = $client->getBasicData($regCode);
$data = $client->getBasicData($regCode);
echo "Aadress: {$data->street} {$data->postCode} {$data->city}\n";
echo "Address: {$data->street} {$data->postCode} {$data->city}\n";


$regCode = '10256136'; // kontrollnumber on vale!
$regCode = '10256136'; // check number is invalid!
if (!$client->isRegCodeValid($regCode)) {
if (!$client->isRegCodeValid($regCode)) {
     echo "Äriregistri kood {$regCode} on vigane.\n";
     echo "Registry code {$regCode} is incorrect.\n";
} else {
} else {
     echo "Äriregistri kood {$regCode} on korrektne\n";
     echo "Registry code {$regCode} is correct.\n";
}
}


Line 404: Line 410:
</pre>
</pre>


Programmi väljund:
Program output:


<pre>
<pre>
Line 428: Line 434:


)
)
Äriregistri kood 10256137 kuulub ettevõttele KREDIIDIINFO AS
Registry code 10256137 belongs to the company CREDITINFO EESTI AS
Aadress: Narva mnt 5 10117 Tallinn
Address: Narva mnt 5 10117 Tallinn
Äriregistri kood 10256136 on vigane.
Registry code 10256136 is incorrect.


</pre>
</pre>
= HTTP päringute näidised =
Failis [http://services.krediidiinfo.ee/wiki/images/e/ed/KiCompany_request_examples.zip kiCompany_request_examples.zip] on KiCompany HTTP päringute ja päringu vastuste näidised. Kui KiCompany integreeritakse süsteemi saates otse HTTP päringuid, siis HTTP vastuse parsimisel kasutada XML vahendeid. Mitte käsitleda HTTP vastuseid kui stringe ja parsida neid nö käsitsi. Kui Krediidiinfo uuendab SOAP serveri tarkvara, siis võib vastuse sõnumi kuju muutuda.

Latest revision as of 10:05, 4 October 2021

Flag of Estonia.svg eesti keeles

Introduction

KiCompany is the name of a Web Service based on SOAP protocol for requesting basic data about companies, non-profit organizations and state agencies. The interface is designed clients who want to integrate the functionality of company request into their own system.

WSDL

KiCompany WDSL is located at http://services.krediidiinfo.ee/KiCompany.wsdl.

WSDL for users of Microsoft Development Tools is located at: http://services.krediidiinfo.ee/KiCompanyLit.wsdl. It differs from the previous WSDL in that RPC/litteral is used instead of RPC/encode.

.NET core development tools compatible wsdl is located at: http://services.krediidiinfo.ee/KiCompanyNetCore.wsdl, url: https://services.krediidiinfo.ee/soap.php?name=KiCompany&ver=NetCore

Testing

In short KiCompany testrequests require the relevant permission and adding "debug" parameter to the URL (https://services.krediidiinfo.ee/soap.php?name=KiCompany -> https://services.krediidiinfo.ee/soap.php?name=KiCompany&debug). More and detailed information about testing can be found on the http://services.krediidiinfo.ee/wiki/index.php/Web_Service_Debugging page.

Methods

getName

Requesting company’s name.

Name Type Description
Input parameter: regCode xs:string Company’s registry code.
Output parameter: name xs:string Company’s name. Output value is an empty string if the name is not found (compnay does not exist, error in the registry code etc).


findCompanies

Searching companies by name. The result is an array, which includes companies’ names and registry codes according to the search string.

Name Type Description
Input parameter: name xs:string Company’s name or the beginning of it. Inserting % at the start will search the existence of that string anywhere in the company's name. NB! Search with % can be considerably slower.
count xs:int Maximum number of companies found in the result of the method (The method does not return at once more than 100 companies)
Output parameter: companies ResultCompanyIDDataArray Indexed array which elements are ResultCompanyIDData array elements.


ResultCompanyIDData is a record with the following structure:

Name Type Description
regCode xs:string Company’s registry code
name xs:string Company’s name.

getBasicData

Requesting company’s basic data.

Name Type Description
Input parameter: regCode xs:string Company’s registry code.
Output parameter: data CompanyBasicDataType A record with company’s data.


If the company according regCode is not found, the SOAP error message code -10231 will be returned.

CompanyBasicDataType record with the following structure:

Name Type Description
regCode xs:string Company’s registry code
name xs:string Company’s name.
street xs:string Street name in postal address (for marketing activities)
postCode xs:string Postcode in postal address (for marketing activities)
city xs:string Name of the city in postal address (for marketing activities)
legalStreet xs:string Street name in legal address
legalPostCode xs:string Postcode in legal address
legalCity xs:string Name of city in legal address
phones xs:string Phone numbers
faxes xs:string Fax numbers
web xs:string Website URL
emails xs:string E-post addresses
legalForm xs:string Legal form
shareCapital xs:int Amount of share capital
shareCapitalCur xs:string Currency of share capital
regTime xs:string Company’s registration time in Commercial Register. Format: yyyy-mm-dd
regPlace xs:string Name of registration department where company was registered
activities xs:string The list of company’s activities. Before every activity there is a string '* ' (asterisk and space). From 7/29/2011 an empty string will be given as a result.
status xs:string Status in Commercial Register

getContactData

Requesting company’s contact data.

Name Type Description
Input parameter: regCode xs:string company’s registry code.
Output parameter: data CompanyContactDataType A record with contact data

If the company according regCode is not found, the SOAP error message code -10231 will be returned.

CompanyContactDataType record is with the following structure:

Name Type Description
street xs:string Street name in postal address (for marketing activities)
postCode xs:string Postcode in postal address (for marketing activities)
city xs:string Name of the city in postal address (for marketing activities)
phones xs:string Phone numbers
faxes xs:string Fax numbers
web xs:string Website URL
emails xs:string E-post addresses


getLegalPostAddress

Requesting company’s legal post address.

Name Type Description
Input parameters: regCode xs:string company’s registry code.
Output parameter: data CompanyPostAddressType A record with legal address data

If the company according regCode is not found, the SOAP error message code -10231 will be returned.

CompanyPostAddressType record is with the following structure:

Name Type Description
street xs:string street name
postCode xs:string postcode
city xs:string city


isRegCodeValid

Verification of company’s registry code.

Name Type Description
Input parameter: regCode xs:string Company’s registry code
Output parameter: isValid xs:boolean True if registry code given with parameter is an eight-digit number and the last check digit is correct.



getVATNo

Requesting company’s VAT number .

Name Type Description
Input parameter: regCode xs:string Company’s registry code.
Output parameter: vatNo xs:string VAT number. If VAT number is not valid or the company is not VAT pager, an empty string will be given.


Error codes

-10231 No company found!

No company found with the registry code given for parameter from Creditinfo’s database. Check the registry code.

(see more general error codes)


Example in PHP

Example of using KiCompany web service in PHP.

<?php
/**
 * Example of using KiCompany web service of Creditinfo Eesti AS
 * 
 * @author Rait Kapp <rait@creditinfo.ee>
 * @created 15.02.2011
 */
$wsdl_url = 'http://services.krediidiinfo.ee/KiCompany.wsdl';
$server_url = 'https://services.krediidiinfo.ee/soap.php?name=KiCompany'; 


$params = array('location' => $server_url
              , 'login'         => 'online_code' // Online Code issued by Creditinfo client management. Make sure that login value is string type (PHP bug?).
              , 'password'      => 'passwd'
//              , 'proxy_host'    => 'cache.neti.ee'   // If necessary use proxy and proxy port.
//              , 'proxy_port'    => 8080
              , 'encoding' => 'ISO-8859-13'
               );


$client = new SoapClient($wsdl_url, $params);


$name = 'KREDIIDI';
$companies = $client->findCompanies($name, 3);
print_r($companies);

$regCode = '10256137';
$name = $client->getName($regCode);
echo "Registry code {$regCode} belongs to the company {$name}\n";

$data = $client->getBasicData($regCode);
echo "Address: {$data->street} {$data->postCode} {$data->city}\n";

$regCode = '10256136'; // check number is invalid!
if (!$client->isRegCodeValid($regCode)) {
    echo "Registry code {$regCode} is incorrect.\n";
} else {
    echo "Registry code {$regCode} is correct.\n";
}

?>

Program output:

Array
(
    [0] => stdClass Object
        (
            [regCode] => 90006012
            [name] => KREDIIDI JA EKSPORDI GARANTEERIMISE SIHTASUTUS KREDEX
        )

    [1] => stdClass Object
        (
            [regCode] => 10704587
            [name] => KREDIIDI JÄRELVALVE OÜ
        )

    [2] => stdClass Object
        (
            [regCode] => 11626688
            [name] => KREDIIDIBÜROO OÜ
        )

)
Registry code 10256137 belongs to the company CREDITINFO EESTI AS
Address: Narva mnt 5 10117 Tallinn
Registry code 10256136 is incorrect.