I have been struggling to get the Exact Online Api to work. It should be possible to make items through the API, but the API isn't allowing me to make 1.
As result of an earlier problem, I got recommended to switch to the unofficial picquer library: Found here.
I got the following code:
$itemModel->CostPriceNew = $newPrice;
$itemModel->CostPriceStandard = $standardPrice;
$itemModel->Description = $description;
$itemModel->Code = $code;
$itemModel->SearchCode = $searchCode;
$itemModel->IsSalesItem = false;
$itemModel->IsPurchaseItem = true;
$itemModel->Unit = 'pc';
$itemModel->IsTime = false;
$itemModel->CostPriceCurrency = 'EUR';
$itemModel->IsStockItem = false;
$itemModel->IsSubcontractedItem = false;
$itemModel->IsPackageItem = false;
$itemModel->IsSerialItem = false;
$itemModel->IsSerialNumberItem = false;
$itemModel->IsFractionAllowedItem = false;
$itemModel->StartDate = $startDate;
$itemModel->EndDate = $endDate;
$itemModel->ItemGroup = $itemGroup;
$itemModel->save();
I found it frustating that so much is required when the documentation (Exact Api Item information) says only 2 are required.
Anyway, the code goes wrong on :
$itemModel->Unit = 'pc';
Error 500: A problem has occurred. The cause of this issue will be investigated as soon as possible.
I double checked if the code existed, changed into a different one. Made a custom code to test with. If I remove the line, it gives me the error
Error 500: Required: Unit
If I alter the code to a non-existing code:
Error 500: Invalid reference: Units
To test, I made a product on the Exact website. I retrieved it through the API and gave the Unit to my new product. The same error popped up.
I made a ticket, but Exact cant find anything wrong on their side.
Anyone encountered this before and has a solution for it?
edit: my json:
{
"ExtraDescription": "Child from 75 . Number 24 out of 25",
"CostPriceNew": 170,
"CostPriceStandard": 170,
"Description": "Vrouwentongen",
"Code": "3255",
"SearchCode": "3255",
"IsSalesItem": false,
"IsPurchaseItem": true,
"Unit": "pc",
"IsTime": false,
"CostPriceCurrency": "EUR",
"IsStockItem": false,
"IsSubcontractedItem": false,
"IsPackageItem": false,
"IsSerialItem": false,
"IsSerialNumberItem": false,
"IsFractionAllowedItem": false,
"StartDate": "2005-01-01T12:00",
"EndDate": "2030-12-12T12:00",
"ItemGroup": "4078e7a5-a61c-4751-8875-875f36810554",
"IsBatchNumberItem": 0,
"Class_01": null,
"Class_02": null,
"Class_03": null,
"Class_04": null,
"Class_05": null,
"CopyRemarks": 0,
"Created": null,
"CreatorFullName": null,
"Creator": null,
"Division": null,
"FreeBoolField_01": null,
"FreeBoolField_02": null,
"FreeBoolField_03": null,
"FreeBoolField_04": null,
"FreeBoolField_05": null,
"FreeDateField_01": null,
"FreeDateField_02": null,
"FreeDateField_03": null,
"FreeDateField_04": null,
"FreeDateField_05": null,
"FreeNumberField_01": null,
"FreeNumberField_02": null,
"FreeNumberField_03": null,
"FreeNumberField_04": null,
"FreeNumberField_05": null,
"FreeNumberField_06": null,
"FreeNumberField_07": null,
"FreeNumberField_08": null,
"FreeTextField_01": null,
"FreeTextField_02": null,
"FreeTextField_03": null,
"FreeTextField_04": null,
"FreeTextField_05": null,
"FreeTextField_06": null,
"FreeTextField_07": null,
"FreeTextField_08": null,
"FreeTextField_09": null,
"FreeTextField_10": null,
"GLCostsCode": null,
"GLCostsDescription": null,
"GLCosts": null,
"GLRevenueCode": null,
"GLRevenueDescription": null,
"GLRevenue": null,
"GLStockCode": null,
"GLStockDescription": null,
"GLStock": null,
"ID": "eece9df4-bf5d-4986-8429-76beb6e519cc",
"IsBatchItem": 0,
"IsMakeItem": 0,
"IsNewContract": 0,
"IsOnDemandItem": 0,
"IsRegistrationCodeItem": 0,
"IsWebshopItem": 0,
"ItemGroupCode": null,
"ItemGroupDescription": null,
"Modified": null,
"ModifierFullName": null,
"Modifier": null,
"Notes": null,
"SalesVatCodeDescription": null,
"SalesVatCode": null,
"SecurityLevel": null,
"UnitDescription": null
}