Skip to main content

Create Product

Request

POST:/{accountBookId}/product

Request Body

object: Product Input Model

Example Request Body

Example: Create "Shirt" product with "Colour" and "Size" product variants.

Example product variant info
  • "Colour" as variant 1 with "Blue", "Green" and "Red" variant options.
  • "Size" as variant 2 with "Small", "Medium" and "Large" variant options.

Product Variant Overview

Filling field values in request body object.

Product Master Input Model

Example input values for product field.

"product": {
"productCode": "P-00001",
"productName": "Hoodie",
"productName2": "",
"productType": "I",
"unit": "hoodies",
"price": 350,
"minPrice": 350,
"cost": 200,
"productCategoryName": "Apparel",
"postingGroup": "Default",
"supplyTaxCode": "S-5",
"purchaseTaxCode": "P-5",
"tariffCode": "40159000",
"status": "A",
"image": null,
"furtherDescription": "",
"note": "",
"supplier": "400-0001",
"variant1Name": "Colour",
"variant2Name": "Size",
"barCode": null,
"classificationCode": null,
"unitType": null,
"cannotConsolidateInvoice": false
}
Product Variant Option Input Model

Example input for productVariant1Options and productVariant2Options fields, based on the image below.

Product Variant Options

 "productVariant1Options": [
{
"variantOption": "Blue",
"image": null
},
{
"variantOption": "Green",
"image": null
},
{
"variantOption": "Red",
"image": null
}
],
"productVariant2Options": [
{
"variantOption": "Large",
"image": null
},
{
"variantOption": "Medium",
"image": null
},
{
"variantOption": "Small",
"image": null
}
]
Product Variant Input Model

Example input for productVariants field, based on the image below.

Product Variants

"productVariants": [
{
"productVariant1OptionName": "Blue",
"productVariant2OptionName": "Large",
"price": 400,
"minPrice": 350,
"stockCode": "P-00001-Blue-Large",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Blue",
"productVariant2OptionName": "Medium",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Blue-Medium",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Blue",
"productVariant2OptionName": "Small",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Blue-Small",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Green",
"productVariant2OptionName": "Large",
"price": 400,
"minPrice": 350,
"stockCode": "P-00001-Green-Large",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Green",
"productVariant2OptionName": "Medium",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Green-Medium",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Green",
"productVariant2OptionName": "Small",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Green-Small",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Red",
"productVariant2OptionName": "Large",
"price": 400,
"minPrice": 350,
"stockCode": "P-00001-Red-Large",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Red",
"productVariant2OptionName": "Medium",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Red-Medium",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Red",
"productVariant2OptionName": "Small",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Red-Small",
"barCode": null,
"image": null
}
]

Combined example:

{
"product": {
"productCode": "P-00001",
"productName": "Hoodie",
"productName2": "",
"productType": "I",
"unit": "hoodies",
"price": 350,
"minPrice": 350,
"cost": 200,
"productCategoryName": "Apparel",
"postingGroup": "Default",
"supplyTaxCode": "S-5",
"purchaseTaxCode": "P-5",
"tariffCode": "40159000",
"status": "A",
"image": null,
"furtherDescription": "",
"note": "",
"supplier": "400-0001",
"variant1Name": "Colour",
"variant2Name": "Size",
"barCode": null,
"classificationCode": null,
"unitType": null,
"cannotConsolidateInvoice": false
},
"productVariant1Options": [
{
"variantOption": "Blue",
"image": null
},
{
"variantOption": "Green",
"image": null
},
{
"variantOption": "Red",
"image": null
}
],
"productVariant2Options": [
{
"variantOption": "Large",
"image": null
},
{
"variantOption": "Medium",
"image": null
},
{
"variantOption": "Small",
"image": null
}
],
"productVariants": [
{
"productVariant1OptionName": "Blue",
"productVariant2OptionName": "Large",
"price": 400,
"minPrice": 350,
"stockCode": "P-00001-Blue-Large",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Blue",
"productVariant2OptionName": "Medium",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Blue-Medium",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Blue",
"productVariant2OptionName": "Small",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Blue-Small",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Green",
"productVariant2OptionName": "Large",
"price": 400,
"minPrice": 350,
"stockCode": "P-00001-Green-Large",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Green",
"productVariant2OptionName": "Medium",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Green-Medium",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Green",
"productVariant2OptionName": "Small",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Green-Small",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Red",
"productVariant2OptionName": "Large",
"price": 400,
"minPrice": 350,
"stockCode": "P-00001-Red-Large",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Red",
"productVariant2OptionName": "Medium",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Red-Medium",
"barCode": null,
"image": null
},
{
"productVariant1OptionName": "Red",
"productVariant2OptionName": "Small",
"price": 350,
"minPrice": 350,
"stockCode": "P-00001-Red-Small",
"barCode": null,
"image": null
}
]
}

Example Request URL:

Parameters:
accountBookId = 1

URL:
POST: https://accounting-api.autocountcloud.com/1/product

Response

Success Response

Code: 201

Response Headers

location: The link to the created record, similar to request url in Get Product API method.

Example Success Response Headers
content-length: 0 
date: Fri,17 Mar 2023 10:25:41 GMT
location: https://localhost:44311/1/product?code=P-00001
server: Microsoft-IIS/10.0
x-powered-by: ASP.NET
x-rate-limit-limit: 1m
x-rate-limit-remaining: 99
x-rate-limit-reset: 2023-03-17T10:26:39.4282030Z

Error Response

Response Body

object: Error Response Model

Example Error Response Body
{
"statusCode": 401,
"message": "401 Unauthorized."
}