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?
– nullptr
const Company = require('./models/Company'); module.Exports = { async index(req, res) { }, async store(req, res) { const cnpj = req.body; } } }
– Fabio Pereira
Edit on the question for kindness
– nullptr
I didn’t understand... sorry
– Fabio Pereira
Include the code in your question, not in the comment. Try mounting a MVCE
– nullptr
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.– Valdeir Psr