1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "csv": `SKU,Product Name,Details,Product URL,Image URL,Stock Status,Regular Price,Manufacturer,Part Number
12SUP-001,Oak desk,<p>Compact oak writing desk</p>,https://example.com/desk,https://example.com/desk.jpg,In stock,129.00,Example Studio,OAK-1
13SUP-002,Reading lamp,<p>Adjustable & warm light</p>,https://example.com/lamp,https://example.com/lamp.jpg,Out of stock,39.00,Example Studio,LAMP-2`,
14 "mapping": {
15 "id": "SKU",
16 "title": "Product Name",
17 "description": "Details",
18 "link": "Product URL",
19 "image_link": "Image URL",
20 "availability": "Stock Status",
21 "price": "Regular Price",
22 "brand": "Manufacturer",
23 "gtin": "",
24 "mpn": "Part Number",
25 "condition": "",
26 "sale_price": "",
27 "availability_date": "",
28 "item_group_id": "",
29 "color": "",
30 "size": ""
31 },
32 "options": {
33 "currency": "EUR",
34 "stripHTML": true,
35 "normalizeAvailability": true
36 }
37};
38
39
40const run = await client.actor("onixcatalogdesk/onix-catalog-mapper").call(input);
41
42
43console.log('Results from dataset');
44console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
45const { items } = await client.dataset(run.defaultDatasetId).listItems();
46items.forEach((item) => {
47 console.dir(item);
48});
49
50