duankuixi1930 2016-03-21 09:16
浏览 78
已采纳

无法通过Exact Online REST API创建项目

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
}
  • 写回答

1条回答 默认 最新

  • dongyou26216708 2016-03-22 10:51
    关注

    You get this error message because the SecurityLevel has the wrong type. The error message should have been more clear. If you try it now, you should get an error message which gives you more detail (at least it did for me). This has been modified with an update of Exact Online.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)