1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "csvContent": `Handle,Title,Body (HTML),Vendor,Type,Tags,Published,Option1 Name,Option1 Value,Variant SKU,Variant Grams,Variant Inventory Qty,Variant Inventory Policy,Variant Fulfillment Service,Variant Price,Variant Compare At Price,Variant Requires Shipping,Variant Taxable,Variant Barcode,Image Src,Image Position,Status
12cafe-mug,Café Mug,<p>Stoneware mug</p>,Acme,Mugs,"mug, coffee",TRUE,Title,Default Title,MUG-001,350,12,deny,manual,$12.50,,TRUE,TRUE,1.23457E+12,https://drive.google.com/file/d/1AbCdEfGhIjK/view?usp=sharing,1,active
13cafe-mug,,,,,,,,,,,,deny,manual,12.50,,TRUE,TRUE,,https://cdn.example.com/mug-back.jpg,2,
14Mug Big,Big Mug,<p>Large mug</p>,Acme,Mugs,mug,yes,Size,Large,MUG-001,500,5,deny,manual,"12,50",,TRUE,TRUE,36000291452,https://cdn.example.com/big mug.jpg,1,Active
15tee,Basic Tee,<p>Cotton tee</p>,Acme,Shirts,tee,TRUE,Size,S,TEE-S,200,3,deny,manual,9.99,8.00,TRUE,TRUE,,https://cdn.example.com/tee.jpg,1,active
16tee,,,,,,,,S,TEE-S2,200,4,deny,manual,9.99,,TRUE,TRUE,,,,`
17};
18
19
20const run = await client.actor("naricky/product-csv-import-validator").call(input);
21
22
23console.log('Results from dataset');
24console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
25const { items } = await client.dataset(run.defaultDatasetId).listItems();
26items.forEach((item) => {
27 console.dir(item);
28});
29
30