My Products
Help
Gert-Jan van der Kamp
CONTRIBUTOR ***

KitSpecifications POST 500 : InternalServerError

by Gert-Jan van der Kamp

Hi, 

 

I'm moving KitSpecifications from and older system to Visma.Net through the API. 

 

I was able to add a lot of them, however when reviewing the result I noticed something wrong so I deleted them all through the normal web client (as the is no KitSpecifications  delete). 

 

If I GET /v1/KitSpecifications it returns 0 records 

 

Now I want to post them again but that gives me this error: 

{"message":"VismaId: 6d80fb70-42e7-49b9-b0b1-4130f903294e. Error creating INKitSpecHdr. Object reference not set to an instance of an object."}

 

I also tried PUT KitSpecifications /id/revision but indeed those are not found. 

 

Could you help me out here? 

 

 

5 REPLIES 5
Gert-Jan van der Kamp
CONTRIBUTOR ***

by Gert-Jan van der Kamp (Updated ‎25-04-2024 09:59 by Gert-Jan van der Kamp )

Hi Marten,

 

It was the lineNbr indeed (that's what I had wrong on the first attempt, they were all 0 so that same line wat overwritten).

Thought I'd leave it out and have it assigned but apparently that is part of the PK for the KitSpec lines? 

 

All loaded correctly now thx. 

 

 

Marten Voort
VISMA

Hi Gert-Jan, glad it works now! Yes the PK also contains the lineNbr, together with the stockitem and revisionID. This can be a bit trial and error sometimes, but the provided example in https://integration.visma.net/API-index/ should always work or give a meaningful error message. 

Gert-Jan van der Kamp
CONTRIBUTOR ***

by Gert-Jan van der Kamp

Through the API I am able to add Stock Components. 

 

GertJanvanderKamp_1-1713966549633.png

 

Tried adding one with revision STANDAARD2 and get the same error: 

{"message":"VismaId: 282b14e4-36f5-4759-9da2-391ec9ccb7af. Error creating INKitSpecHdr. Object reference not set to an instance of an object."}

 

POST https://integration.visma.net/API/controller/api/v1/KitSpecifications

{
"operation": "Insert",
"kitInventoryID": {
"value": "13.20.00.00.00"
},
"revisionID": {
"value": "STANDAARD2"
},
"isActive": {
"value": true
},
"allowCompAddition": {
"value": true
},
"isNonStock": {
"value": false
},
"stockComponentLines": [
{
"operation": "Insert",
"compInventoryID": {
"value": "13.22.32.15.00"
},
"dfltCompQty": {
"value": 9
}
},
{
"operation": "Insert",
"compInventoryID": {
"value": "13.24.50.75.00"
},
"dfltCompQty": {
"value": 7
}
},
{
"operation": "Insert",
"compInventoryID": {
"value": "14.30.35.00.80"
},
"dfltCompQty": {
"value": 150
}
}
]
}

 

Accepted solution
Marten Voort
VISMA

Thx for the payload information! It seems the "lineNbr": { "value": 0 element is missing after "stockComponentLines": [   { "operation": "Insert"

Can you try adding this?
Marten Voort
VISMA

by Marten Voort

Hi Gert-Jan, can you describe how you have deleted the incorrect items? Are you able to add any kitspecifications at all? If not can you try to upload a different revision?