Skip to main content

Update Credit Note

Request

PUT:/{accountBookId}/creditNote

Request Parameters

ParameterDescriptionType
docNoDocument number of record.stringrequired

Request Body

object: Credit Note Input Model

Example Request Body
caution
When updating document master data, only the fields to be updated need to be added to the request body. Fields that do not need to be updated should be omitted entirely instead of being left with a blank value.

Omitting the field in the request body will maintain the original value of the field while leaving the field value blank will remove the existing value of the field in the document.
Update specific fields in master data

Example: Update reason field in master data.

{
"master": {
"reason": "Incorrect colour"
},
"details": [{}]
}
caution

Number of array elements:

When updating document detail data, adding fewer array elements than the number of elements originally held by the details array into the request body will result in removal of detail data rows.

If document detail data is to remain the same, include a `details` array in request body with empty elements corresponding to the number of existing detail data records.

Example: given there are currently 4 detail data records, the request body would look like this:

"details": [{ }, { }, { }, { }]
Add a detail data row

To add a detail data row, add an additional array element at the end of the details array of the request body.

Example: Add a new detail data row for "Long Pants", making use of auto fill options.

{
"master": {},
"details": [
{},
{
"productCode": "P-00002",
"description": "Long Pants",
"qty": 1
}
],
"autoFillOption": {
"accNo": true,
"taxCode": true,
"tariffCode": true,
"unitCost": true
},
"saveApprove": null
}
caution

Sequence of the array elements:

When updating document detail data, the sequence of the detail data array matters as the detail data rows are indexed records.

When updating a specific detail data row, remember to double check the request body before submitting the request to ensure detail data rows are not unintentionally overwritten.
Update fields in detail data

Example: Update description field in detail data rows to "Short Pants".

{
"master": {},
"details": [
{
"description": "Short Pants"
},
{
"description": "Short Pants"
}
]
}

In order to carry out the following:

  • Add a detail data record to a specific row position
  • Delete a specific detail data row

The details input array needs to be re-entered with the intended data.

Add a detail data record to a specific row position

Example: Add a new detail data row for "Long Pants" with a quantity of "2" to the first row of the detail data records.

Re-enter all data in the details field with the new record as the first element in the array.

{
"master": {
},
"details": [
{
"productCode": "P-00002",
"description": "Long Pants",
"qty": 2
},
{
"productCode": "P-00002",
"productVariant": null,
"accNo": "510-0000",
"description": "Pants",
"furtherDescription": "",
"qty": 1,
"unit": "20000",
"unitPrice": 450,
"discount": null,
"taxCode": "S-5",
"tariffCode": "40159000",
"taxExportCountry": null,
"taxPermitNo": null,
"taxAdjustment": 0,
"localTaxAdjustment": 0,
"unitCost": 300,
"goodsReturn": true,
"yourPONo": null,
"yourPODate": null,
"deptNo": null
}
],
"autoFillOption": {
"accNo": true,
"taxCode": true,
"tariffCode": true,
"unitCost": true
},
"saveApprove": null
}

Delete a specific detail data row
Example Data

Given the document contains 3 detail data rows:

{
"master": {...},
"details": [
{
"docKey": 121,
"dtlKey": 266,
"seq": 0,
"productId": 11,
"productCode": "P-00002",
"productVariantId": null,
"productVariant1Option": null,
"productVariant2Option": null,
"accNo": "510-0000",
"description": "Long Pants",
"furtherDescription": "",
"qty": 2.00000000,
"unit": "20000",
"unitPrice": 450.00000000,
"discount": null,
"discountAmt": 0.00,
"taxCode": "S-5",
"taxRate": 5.000000,
"taxAdjustment": 0.00,
"localTaxAdjustment": 0.00,
"tariffCode": "40159000",
"taxExportCountry": null,
"taxPermitNo": null,
"unitCost": 0.21430000,
"subTotalExTax": 900.00,
"localSubTotalExTax": 900.00,
"tax": 45.00,
"localTax": 45.00,
"subTotal": 900.00,
"localSubTotal": 900.00,
"taxCurrencyTax": 45.00,
"taxCurrencySubTotalExTax": 900.00,
"goodsReturn": true,
"yourPONo": null,
"yourPODate": null,
"deptNo": null
},
{
"docKey": 121,
"dtlKey": 268,
"seq": 1,
"productId": 542,
"productCode": "P-00003",
"productVariantId": null,
"productVariant1Option": null,
"productVariant2Option": null,
"accNo": "405-0000",
"description": "Coat",
"furtherDescription": "",
"qty": 1.00000000,
"unit": "3000",
"unitPrice": 300.00000000,
"discount": null,
"discountAmt": 0.00,
"taxCode": "S-5",
"taxRate": 5.000000,
"taxAdjustment": 0.00,
"localTaxAdjustment": 0.00,
"tariffCode": "40159000",
"taxExportCountry": null,
"taxPermitNo": null,
"unitCost": 0.00000000,
"subTotalExTax": 300.00,
"localSubTotalExTax": 300.00,
"tax": 15.00,
"localTax": 15.00,
"subTotal": 300.00,
"localSubTotal": 300.00,
"taxCurrencyTax": 15.00,
"taxCurrencySubTotalExTax": 300.00,
"goodsReturn": true,
"yourPONo": null,
"yourPODate": null,
"deptNo": null
},
{
"docKey": 121,
"dtlKey": 267,
"seq": 2,
"productId": 11,
"productCode": "P-00002",
"productVariantId": null,
"productVariant1Option": null,
"productVariant2Option": null,
"accNo": "510-0000",
"description": "Pants",
"furtherDescription": "",
"qty": 1.00000000,
"unit": "20000",
"unitPrice": 450.00000000,
"discount": null,
"discountAmt": 0.00,
"taxCode": "S-5",
"taxRate": 5.000000,
"taxAdjustment": 0.00,
"localTaxAdjustment": 0.00,
"tariffCode": "40159000",
"taxExportCountry": null,
"taxPermitNo": null,
"unitCost": 0.21430000,
"subTotalExTax": 450.00,
"localSubTotalExTax": 450.00,
"tax": 22.50,
"localTax": 22.50,
"subTotal": 450.00,
"localSubTotal": 450.00,
"taxCurrencyTax": 22.50,
"taxCurrencySubTotalExTax": 450.00,
"goodsReturn": true,
"yourPONo": null,
"yourPODate": null,
"deptNo": null
}
]
}

Example: Remove the second row of detail data records (record with description field value of "Coat").

Re-enter all data in the details field without the second array element.

{
"master": {
},
"details": [
{
"productCode": "P-00002",
"description": "Long Pants",
"qty": 2
},
{
"productCode": "P-00002",
"productVariant": null,
"accNo": "510-0000",
"description": "Pants",
"furtherDescription": "",
"qty": 1,
"unit": "20000",
"unitPrice": 450,
"discount": null,
"taxCode": "S-5",
"tariffCode": "40159000",
"taxExportCountry": null,
"taxPermitNo": null,
"taxAdjustment": 0,
"localTaxAdjustment": 0,
"unitCost": 300,
"goodsReturn": true,
"yourPONo": null,
"yourPODate": null,
"deptNo": null
}
]
}

Example Request URL:

Parameters:
accountBookId = 1
docNo = CN-000001

URL:
PUT: https://accounting-api.autocountcloud.com/1/creditnote?docNo=CN-000001

Response

Success Response

Code: 204

Error Response

Response Body

object: Error Response Model

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