Update defaultDimensions for entities
Update the default dimensions of entities in Business Central.
HTTP request
Replace the URL prefix for Business Central depending on environment following the guideline.
PATCH businesscentralPrefix/companies({id})/defaultDimensions({id})
PATCH businesscentralPrefix/companies({id})/items({id})/defaultDimensions({id})
PATCH businesscentralPrefix/companies({id})/customers({id})/defaultDimensions({id})
PATCH businesscentralPrefix/companies({id})/vendors({id})/defaultDimensions({id})
PATCH businesscentralPrefix/companies({id})/employees({id})/defaultDimensions({id})
Request headers
Header | Value |
---|---|
Authorization | Bearer {token}. Required. |
Content-Type | application/json |
If-Match | Required. When this request header is included and the eTag provided does not match the current tag on the defaultDimension, the default dimensions will not be updated. |
Request body
In the request body, supply the values for relevant fields that should be updated. Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values. For best performance you shouldn't include existing values that haven't changed.
Note
You cannot modify parentId, dimensionId or dimensionCode fields, because these are key fields, and rename is not allowed in Default Dimension record.
Response
If successful, this method returns a 200 OK
response code and an updated default dimensions for the entity in the response body.
Example
Request
Here is an example of the request.
PATCH https://{businesscentralPrefix}/api/v2.0/companies({companyId})/items({itemId})/defaultDimensions({itemId},{dimensionId})
Request body
{
"dimensionValueId":"1045a902-070a-4d31-b2b1-b9431e9e5b26",
"postingValidation":"Same Code"
}
Response
Here is an example of the response.
Note
The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.
{
"id": "5b049aad-bde4-ea11-bbf2-00155df3a615",
"parentId": "53049aad-bde4-ea11-bbf2-00155df3a615",
"dimensionId": "1045a902-070a-4d31-b2b1-b9431e9e5b26",
"dimensionCode": "DEPARTMENT",
"dimensionValueId": "49c99ea7-bde4-ea11-bbf2-00155df3a615",
"dimensionValueCode": "SALES",
"postingValidation": "Same Code"
}
Related information
Tips for working with the APIs
defaultdimension
Get defaultdimension
Delete defaultdimension
Create defaultdimension