logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
ksturm@easy-automation.com  
#1 Posted : Monday, July 28, 2025 8:30:32 PM(UTC)
ksturm@easy-automation.com

Rank: Member

Groups: Registered
Joined: 3/21/2024(UTC)
Posts: 15
United States

When I POST a SalesItem it fails because returnsAndAllowancesAccountId is not specified, despite it being specified in the request. I have done this through the application we're developing and through the Swagger UI that's available with the REST service. We have tried different forms of capitalization and cannot seem to get it to work.

Below is my account request to get an account id that I then supply in the POST SalesItem request and ultimately get a failure response (all seen below).

I am running CenterPoint Accounting 19.9.30.


ACCT GET REQUEST:
curl -X 'GET' \
'http://localhost:54459/api/centerpoint/accounts?number=403000' \
-H 'accept: text/plain' \
-H 'Database: NutritionServices'


ACCT RESPONSE:
[
{
"id": 2147469967,
"abbreviation": "",
"name": "Returns & Allowances",
"number": "403000",
"type": "Revenue",
"category": "Sales Revenue"
}
]


SALESITEM POST REQUEST
curl -X 'POST' \
'http://localhost:54459/api/centerpoint/salesItems' \
-H 'accept: text/plain' \
-H 'Database: NutritionServices' \
-H 'Content-Type: application/json' \
-d '{
"abbreviation": "774",
"name": "AUREO 100",
"active": true,
"expenseAccountId": 2147469993,
"additionalDescription": "AUREO 100",
"salesAccountId": 2147469965,
"salesCategoryId": 2147469999,
"returnsAndAllowancesAccountId": 2147469967
}'


SALESITEM POST RESPONSE:
{
"message": "Invalid Request",
"errors": [
{
"key": "SalesItemModel.ReturnsAndAllowancesAccountId",
"message": "You must have a returns & allowances account before you can continue"
}
]
}
tony  
#2 Posted : Tuesday, July 29, 2025 12:47:39 PM(UTC)
tony

Rank: Advanced Member

Groups: Registered
Joined: 2/28/2018(UTC)
Posts: 80
United States
Location: Pennsylvani mostly

Was thanked: 9 time(s) in 9 post(s)
Ah, sorry.

Set the templateId to an existing inventory item's ID which ensures that all the required information is set. Some people create items in CenterPoint for this purpose because it greatly speeds up the process of manually adding an item. If you have a mix of non-tracked/service and tracked items, then you need a different templateId for each.

The goal was something very simple, but the simplicity requires a templateId (which should be marked as required but is not.)



ksturm@easy-automation.com  
#3 Posted : Tuesday, July 29, 2025 1:18:10 PM(UTC)
ksturm@easy-automation.com

Rank: Member

Groups: Registered
Joined: 3/21/2024(UTC)
Posts: 15
United States

Thank, Tony. We will try using the templateId property instead of explicitly setting each of those account and category properties. For our application that should work just fine.

I'm guessing if we did specify those properties that it would use our specified values instead of the template's values for those properties?
tony  
#4 Posted : Tuesday, July 29, 2025 3:59:01 PM(UTC)
tony

Rank: Advanced Member

Groups: Registered
Joined: 2/28/2018(UTC)
Posts: 80
United States
Location: Pennsylvani mostly

Was thanked: 9 time(s) in 9 post(s)
Yes, the template item provides a starting point only.
Sasa  
#5 Posted : Monday, January 26, 2026 1:08:37 PM(UTC)
Sasa

Rank: Newbie

Groups: Registered
Joined: 12/4/2025(UTC)
Posts: 1
United States

When I try to POST this to the /api/centerpoint/salesItems endpoint

{
"abbreviation": "6696e312f7469df7473337b6",
"active": true,
"expenseAccountId": 2147469938,
"name": "1.25\" X 3.00\" X 4.50\"",
"salesAccountId": 2147469938,
"templateId": 2147469999
}

I get this

{
"message": "Invalid Request",
"errors": [
{
"key": "ApiError",
"message": "Object reference not set to an instance of an object."
}
]
}

Not really clear what is going on. It seems the same error happens with the vendor endpoint but don't have an example of that yet.
tony  
#6 Posted : Monday, January 26, 2026 6:26:46 PM(UTC)
tony

Rank: Advanced Member

Groups: Registered
Joined: 2/28/2018(UTC)
Posts: 80
United States
Location: Pennsylvani mostly

Was thanked: 9 time(s) in 9 post(s)
Much to my surprise, I tried the POST out with the exact Request Body against our BusinessSample database and it worked. I thought at least one of the foreign key IDs would be invalid.

That doesn't tell us much except that it's not some unlikely error like the abbreviation being too long or double quotes being a problem.

I'm not sure where to go from here though. Is this happening on every item you try to add or just this one specifically? And if you try the same POST again does it work? If you have some work and some not, then can you show me the Request Body for a POST that worked?

The fact that adding a vendor sometimes fails too potentially points to something outside the Sales Item infrastructure, but I'm not sure what. I'll think about this some more.



Users browsing this topic
Guest (3)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.