to get a personalized navigation.
to get a personalized navigation.
I create orders where I first need to create subaccounts.
Problem is I can't use the just created subaccount on the order. I need to wait maybe 10-20 minutes before creating the order.
Is there a delay between the API:s? If so, how long do I need to wait?
First create subaccount with Visma Net Api
PUT: https://integration.visma.net/API/controller/api/v1/dimension/SUBACCOUNT/4
{
"segmentValues": [
{
"operation": "Insert",
"value": "2134532",
"description": {
"value": "987654 "
}
}
],
"dimensionId": "SUBACCOUNT",
"segementId": 4
}
Response: 200 OK
Then create order with Sales Order Api
POST: https://salesorder.visma.net/api/v3/SalesOrders
{
"type": "IN",
"orderId": "1023",
"currencyId": "SEK",
"description": "",
"customer": {
"id": "1000011",
},
"orderLines": [
{
"inventoryId": "9521",
"quantity": 1.0,
"unitCost": 0.0,
"unitPrice": 131.0,
"subaccount": {
"1": "252",
"2": "009521",
"3": "1000011",
"4": "2134532",
"5": "4100022"
},
},
],
}
Response: 400 Bad Request
{
"title": "One or more validation errors occurred.",
"status": 400,
"detail": "Refer to the errors property for additional details",
"instance": "/api/v3/SalesOrders",
"details": [
{
"code": "1202-SegmentValueNotFound",
"message": "The value '2134532' is not valid for SegmentId 4",
"parameters": {
"property": "orderLines[0].subaccount"
}
}
],
"errors": {
"DomainValidation": [
"The value '2134532' is not valid for SegmentId 4"
]
}
}
Hi! You are right, for performance reasons the synchronization of cached data is not continuous. The subaccount segments normally do not change often, so there is a maximum delay of 45 minutes, but normally I see the segments being available after 20 minutes. Please consider this margin in your technical setup.
Thank you for your quick reply.
Is fixing this part of the "All functionality currently missing in the new Sales Order Service API will be added before these endpoints are removed."?
New subaccount is probably a rare thing but creating customers at the same time as an order is a common scenario.
Copyright © 2022 Visma.com. All rights reserved.