How to call the Federal Revenue API with Javascript?

Asked

Viewed 188 times

0

I am creating a REST API and when registering the company I would like to inform only the CNPJ, so use the WS revenue to bring the company data.

I’m doing it this way:

const Empresa = require('../models/Empresa');

module.exports = {
    async index(req, res) { }

    async store(req, res) {
        const cnpj = req.body;
        daqui eu pegaria esse cnpj e chamaria a Receita WS
    }
}
  • And what code have you ever made?

  • const Company = require('./models/Company'); module.Exports = { async index(req, res) { }, async store(req, res) { const cnpj = req.body; } } }

  • Edit on the question for kindness

  • I didn’t understand... sorry

  • Include the code in your question, not in the comment. Try mounting a MVCE

  • Following tips: It is complicated due to captcha, but it is possible to automate this. If you want something simpler, the government has a API for CNPJ queries. You can also use the website service Recipe WS or to use crawler on the Internet.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.