My Products
Help
adrianm
PARTNER

Delay between Visma Net API and Sales Order Api

by adrianm

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"
		]
	}
}

 

7 REPLIES 7
Marten Voort
VISMA

by Marten Voort

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.

adrianm
PARTNER

by adrianm

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.

Marten Voort
VISMA

by Marten Voort (Updated ‎03-09-2024 10:12 by Marten Voort VISMA )

At this moment we do not perceive frequent problems with this caching, but we will keep monitoring the cases. The entity Customers should not have a substantial delay, are you experiencing this?

adrianm
PARTNER

by adrianm

Since v3 is not complete I haven't converted any existing integrations yet.

 

But the procedure is usually

* Fetch customer

* CreateCustomer when not found

* CreateOrder

 

So if the delay is more than the API roundtrip time I need to know how much delay to add.

Accepted solution
Marten Voort
VISMA

by Marten Voort

I have just done some testing, for the entity customers there is no noticeable delay, so there is no need to add a delay for this.

SierdW
PARTNER

by SierdW

Is this only applied on the segments or are there more endpoints/entities with this possible delay?

Marten Voort
VISMA

by Marten Voort

Hi Sierd, for the sales order service more low frequency entities are cached, like taxZones, payment terms etc. Normally they will be synced in 15-20 mins.