A common ETL scenario: pull company data from the Openapi IT company API and load it into a local PostgreSQL database for reporting or enrichment pipelines.
use Openapi\Client;
use Openapi\OauthClient;
$oauth = new OauthClient();
$token = json_decode($oauth->createToken(['GET:company.openapi.com/IT-advanced']), true)['token'];
$client = new Client($token);
$companies = json_decode($client->get('https://company.openapi.com/IT-search', [
'provincia' => 'MI',
'codice_ateco' => '6201',
]), true);
foreach ($companies['items'] as $company) {
$pdo->execute(
'INSERT INTO companies (cf, name, address) VALUES (?, ?, ?) ON CONFLICT DO NOTHING',
[$company['cf'], $company['name'], $company['address']]
);
}
Use case
A common ETL scenario: pull company data from the Openapi IT company API and load it into a local PostgreSQL database for reporting or enrichment pipelines.
Example flow
Open questions
examples/?