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.

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

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看