Use the REST API of your Magneto 2 instance: http://mage.host.com/index.php/rest/ ...
You can get OpenAPI defintion (analog WSDL for REST) ββat http://mage.host.com/index.php/rest/default/schema/
Get the authorization token in the first step:
$ curl -X POST "http://mage.host.com/index.php/rest/V1/integration/admin/token" -H "Content-Type:application/json" -d '{"username":"admin", "password":"..."}' "uhb..."
Then publish new product data using the authorization token and the minimum attributes for the new product (4 is the default identifier for the product attribute installed in an empty Magento instance) and get new product data:
$ curl -X POST "http://mage.host.com/index.php/rest/V1/products" -H "Content-Type:application/json" -H "Authorization:Bearer uhb..." -d '{"product": {"sku": "sku01","name": "product 001","attribute_set_id": 4}}' {"id":...,"sku":"sku01","name":"product 001","attribute_set_id":4,"status":..., ...
This is the definition of a product object from OpenAPI (available product attributes for publication):
{ "catalog-data-product-interface": { "type": "object", "description": "", "properties": { "id": {"type": "integer", "description": "Id"}, "sku": {"type": "string", "description": "Sku"}, "name": {"type": "string", "description": "Name"}, "attributeSetId": {"type": "integer", "description": "Attribute set id"}, "price": {"type": "number", "description": "Price"}, "status": {"type": "integer", "description": "Status"}, "visibility": {"type": "integer", "description": "Visibility"}, "typeId": {"type": "string", "description": "Type id"}, "createdAt": {"type": "string", "description": "Created date"}, "updatedAt": {"type": "string", "description": "Updated date"}, "weight": {"type": "number", "description": "Weight"}, "extensionAttributes": {"$ref": "#/definitions/catalog-data-product-extension-interface"}, "productLinks": { "type": "array", "description": "Product links info", "items": {"$ref": "#/definitions/catalog-data-product-link-interface"} }, "options": { "type": "array", "description": "List of product options", "items": {"$ref": "#/definitions/catalog-data-product-custom-option-interface"} }, "mediaGalleryEntries": { "type": "array", "description": "Media gallery entries", "items": {"$ref": "#/definitions/catalog-data-product-attribute-media-gallery-entry-interface"} }, "tierPrices": { "type": "array", "description": "List of product tier prices", "items": {"$ref": "#/definitions/catalog-data-product-tier-price-interface"} }, "customAttributes": { "type": "array", "description": "Custom attributes values.", "items": {"$ref": "#/definitions/framework-attribute-interface"} } }, "required": ["sku"] } }
Switch your Magento 2 instance to "developer" mode to get error messages in REST answers:
$ ./bin/magento deploy:mode:set developer