Skip to content

impercz/merk-suggest-company-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

merk-suggest-company-js

Simple JS library with connection to Merk API providing autocomplete for Czech and Slovak company data.

Merk is a Czech and Slovak company database developed and maintained by Imper CZ s.r.o. and you can find more information about the API (Czech).

Full Merk API documentation is here. Suggestion is implemented with Twitter Typeahead.js.

Setup

If you are going to use with your form follow these steps:

1. Obtain token to Merk

This JS Library requires you to be a registered user of Merk. If you are not current Merk user proceed with free registration to Merk.

After registration, log in your account and go to tab Connection (“Napojení”). There you’ll find your api_key. There you can also reset your API access if needed.

3. Add JS in your html

Download suggest-company.jquery.js and add it into your html site with:

<script src="./js/suggest-company.jquery.js" type="text/javascript" charset="utf-8"></script>

4. Map fields

Map fileds you want to fill from suggestion in your form with

var api_to_inputs = {

5. Setup server side

This is required to hide your token from a public access.

You can use PHP server file we do provide. Just upload folder "server" to your Document root

And set your token. In server/index.php set your token within

$token = "Your token goes here";

Otherwise you'll need to write your own server file.

6. Call suggestion method

Call the method for fields you want to use for suggestion. You can use:

  • Email - exact match
  • Name - suggesting from 3 characters
  • Registration number - exact match.

Call example:

$(function(){
  $('#suggest_name').merkSuggestify({
    suggestBy: 'name',
    proxyUrl: './server/index.php',
    mapping: api_to_inputs
  });
});

You can also use our example form from client-server.html and basic CSS styles.

Limitations

The number of API requests allowed depends on the tariff purchased. If you need more feel free to contact us at podpora@merk.cz.

Browser Support

  • Chrome
  • Firefox 3.5+
  • Safari 4+
  • Internet Explorer 8+
  • Opera 11+

Suggestion is not tested on mobile devices.

License

Copyright 2016 Imper CZ s.r.o.

Licensed under the MIT License.