Importing Products
Last update: 2 years ago by luigi mangaReading time: 2 min
If you are migrating from a custom backend or frontend marketplace to Onport, you may need to import your existing product catalog into Onport.
To do this, you'll need to call POST /api/channels/import-connector-variant-batch.json
endpoint with the following payload.
This will import the variants and their associated data (e.g. prices, option values etc) in a single payload.
{"externalGroupId": "external-group","variants": [{"externalGroupId": "external-group-id","vendorName": "My vendor","name": "product-name","description": "product-description","productType": "product-type","handle": "my-project","externalId": "external-id","sku": "external-id","inventoryQuantity": 10,"costPrice": 5.99,"retailPrice": 9.99,"compareAtPrice": 19.99,"inventoryPolicy": "track","images": [],"grams": 10,"options": [{"name": "Colour","value": "Blue"}]}],"source": "custom","cleanup": true}
You can import multiple products (up to 50 per request) by making a POST call to /api/channels/:id/import-connector-variant-batches.json
and passing an array as payload.
[{"externalGroupId": "external-group","variants": [{"externalGroupId": "external-group-id","vendorName": "My vendor","name": "product-name","description": "product-description","productType": "product-type","handle": "my-project","externalId": "external-id","sku": "external-id","inventoryQuantity": 10,"costPrice": 5.99,"retailPrice": 9.99,"compareAtPrice": 19.99,"inventoryPolicy": "track","images": [],"grams": 10,"options": [{"name": "Colour","value": "Blue"}]}],"source": "custom","cleanup": true},{"externalGroupId": "external-group-1","variants": [{"externalGroupId": "external-group-id1","vendorName": "My vendor","name": "product-name1","description": "product-description","productType": "product-type","handle": "my-project","externalId": "external-id-1","sku": "external-id-1","inventoryQuantity": 10,"costPrice": 5.99,"retailPrice": 9.99,"compareAtPrice": 19.99,"inventoryPolicy": "track","images": [],"grams": 10,"options": [{"name": "Colour","value": "Blue"}]}],"source": "custom","cleanup": true}]