API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Create Products on e-conomic

0
Product Creation doesnt work and i keep getting the following error :

{"message":"Validation failed. 3 error(s) found.","errorCode":"E04300","developerHint":"Inspect validation errors and correct your request.","logId":"9065997c810224720e382edda97184d3","httpStatusCode":400,"errors":{"name":{"errors":[{"errorMessage":"Property name is null or empty.","errorCode":"E04041","developerHint":"Property name must not be null or empty."}]},"productGroup":{"errors":[{"errorMessage":"Property productGroup is null.","errorCode":"E04042","developerHint":"Property productGroup must not be null."}]},"productNumber":{"errors":[{"errorMessage":"Property productNumber is null or empty.","errorCode":"E04041","developerHint":"Property productNumber must not be null or empty."}]}},"logTime":"2017-02-15T16:59:54","errorCount":3}

and this is my request that im sending :

POST https://restapi.e-conomic.com/products HTTP/1.1
X-AppSecretToken: xxx
X-AgreementGrantToken: xxx
Host: restapi.e-conomic.com
Content-Length: 324

{
    "productNumber": "UniqueAlphanumeric",
    "name": "Descriptive name of the product.",
    "description": "Free text description of product.",
    "costPrice": 100,
    "recommendedPrice": 100,
    "salesPrice": 100,
    "barred": false,
    "unit": {
            "unitNumber": 1,
    },
    "productGroup": {
            "productGroupNumber": 1
    }
}
created Feb 15 by ati
0% Accept Rate

edited Feb 15 by ati
Q 1 A 0 C 3
I have even tried the following Json :
{
    "productNumber": "100",
    "name": "Home Booster",
    "recommendedPrice": 0.00,
    "salesPrice": 0.00,
    "barred": false,
    "productGroup": {
        "productGroupNumber": 2,
        "name": "Tjänster 25%",
        "salesAccounts": "https://restapi.e-conomic.com/product-groups/2/sales-accounts",
        "products": "https://restapi.e-conomic.com/product-groups/2/products",
        "self": "https://restapi.e-conomic.com/product-groups/2"
    },
    "unit": {
        "unitNumber": 1,
        "name": "St",
        "self": "https://restapi.e-conomic.com/units/1"
    },
    "pricing": {
        "currencySpecificSalesPrices": "https://restapi.e-conomic.com/products/1/pricing/currency-specific-sales-prices"
    }
}
Hello @ati,

Both calls are resulting with product creation, in the first one you have syntax error that should be corrected.

If you still encounter problems, please contact us directly at api@e-conomic.com
Hi, you are right the 2nd one works. I was also missing a header in request "Content-Type: application/json"

Thanks for the help

Visma e-conomic A/S
...