Giter Site home page Giter Site logo

Comments (3)

fvdm avatar fvdm commented on July 22, 2024

Ah yes I still need to port that package (and my blog post) to the Overheid.io API.

That might take a while, so you better use my overheid.io package instead, like this:

const kvk = require ('overheid.io') ({
  apikey: 'YOUR APIKEY',
  dataset: 'kvk'
});

function output (err, data) {
  console.dir (err || data, {
    depth: null,
    colors: true
  });
}

kvk ({
  params: {
    'filters[handelsnaam]': 'ahold'
  },
  callback: output
});

from nodejs-openkvk.

ErikHoeven avatar ErikHoeven commented on July 22, 2024

Thanks for your alternative solution,

I execute the following code (based on your readme.md) in the node_module\overheid.io folder.

var openkvk = require ('overheid.io') ({
    apikey: 'mijnAPI',
    dataset: 'kvk'
});

openkvk ({
                params: {
                    'filters[handelsnaam]': '*' + 'Advocaten' + '*'
                },
                callback: function (err, data) {
                    if (err) { return console.log (err) }

                    console.info(data.handelsnaam + ' : ' + data.plaats)
                }
              })

The result i get from the console is:

undefined : undefined

While i expected:

Advocaat 1  :  Plaats 1
Advocaat 2  :  Plaats 2

What am i doing wrong?

Manny thanks

from nodejs-openkvk.

fvdm avatar fvdm commented on July 22, 2024
  • Either don't use wildcards on filter or use the query parameter instead.
  • You need to specify plaats in the fields parameter to include it in the result data.
  • This module returns the raw data object, so the results are stored in the data._embedded.rechtspersoon array.
openkvk ({
  params: {
    query: '*Advocaten*',
    queryFields: ['handelsnaam'],
    fields: ['plaats']
  },
  callback: (err, data) => {
    if (err) { return console.log (err); }

    if (data.totalItemCount) {
      data._embedded.rechtspersoon.forEach (item => {
        console.log (item.handelsnaam + ' : ' + item.plaats);
      });
    }
  }
});

For some reason they include the country in plaats, I think that could be a bug in their API. I have filed a report with them.

from nodejs-openkvk.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.