基于Acumatica REST基于REST合同的API SalesInvoice实体18.200.001的问题

时间:2019-05-10 04:26:37

标签: acumatica

通过Rest API自动创建销售发票 无法填充CustomerLocation

在WebService EndPoint中,此项的“映射对象”和“映射字段”为空白

有人成功使用此API修改了位置信息吗? 是否有人知道我的JSON for Linked Entities是否存在格式错误,该错误与文档相符,但可能不是最新的?

根据指南和经验,尝试了几种JSON格式,包括链接,摘要,自定义和详细信息

尝试了BillToSettings和BillingSetting实体

搜索到的已知问题,牛顿JSon


  "Type": { "value": "Invoice" },
  "CustomerID": { "value": "C0004055" },
  /// bit does not create in Acumatica
  "BillToSettings": { "CustomerLocation": { "value": "67217" } },
  /// "BillingSettings" : {"CustomerLocation" : {"value" : "67217"}
  /// also LocationID, CustomerLocationID and many combinations there of
  "CustomerOrder": { "value": 1942 },
  "Date": { "value": "2/14/2019" },
  "Description": { "value": "SO S048773" },
  "Details": [
    {
      "InventoryID": { "value": "POLLING-HOSTING" },
      "TransactionDescr": { "value": "GPRS Monitoring" },
      "UOM": { "value": "PNTS" },
      "Qty": { "value": "3" },
      "UnitPrice": { "value": "68.25" }
    },
    {
      "InventoryID": { "value": "AIRTIME" },
      "TransactionDescr": { "value": "GPRS Airtime" },
      "UOM": { "value": "EACH" },
      "Qty": { "value": "3" },
      "UnitPrice": { "value": "20" }
    }
  ]

我希望默认的MAIN位置会被67217覆盖,而不是每个记录都显示main 如果我添加地址“覆盖”字段(如下所示),那么我会在成功创建发票时获取它们的数据,但不会返回CustomerLocation数据。 位置ID也无法正确更新

BillingSettings = new
                {
                    BillToAddressOverride = new {value = true},
                    BillToContactOverride = new { value = true },
                    CustomerLocation = new { value = "67217"}
                },

1 个答案:

答案 0 :(得分:2)

我试图在2019R1的全新SalesDemo安装上使用您的JSON示例,并且可以复制您遇到的相同问题。

认为CustomerLocation字段未映射到默认18.200.001端点有关。如果我们查看响应对象,这实际上是有道理的-响应中也没有CustomerLocation字段。

第一次尝试,而没有扩展API端点:

{
   "Type": {
      "value": "Invoice"
   },
   "CustomerID": {
      "value": "ABARTENDE"
   },
   "Date": {
      "value": "5/10/2019"
   },
   "Description": {
      "value": "Test SalesInvoice Creation"
   },
   "BillingSettings" : {
        "CustomerLocation" : {
            "value" : "VEGAS"
        }
   }
}

第一次尝试的响应:

"BillingSettings": {
    "BillToAddress": {
        "AddressLine1": {
            "value": "201 Lower Notch Rd"
        },
        "AddressLine2": {},
        "City": {
            "value": "Little Falls"
        },
        "Country": {
            "value": "US"
        },
        "PostalCode": {
            "value": "07424"
        },
        "State": {
            "value": "NJ"
        }
    },
    "BillToAddressOverride": {
        "value": false
    },
    "BillToContact": {
        "Attention": {
            "value": "Accounts Receivable"
        },
        "BusinessName": {
            "value": "USA Bartending School"
        },
        "Email": {
            "value": "barkeep@usabartend.con"
        },
        "Phone1": {
            "value": "+1 (908) 532-9522"
        }
    },
    "BillToContactOverride": {
        "value": false
    }
}

如果您extend终端节点并实现Location字段(在填充该字段时位于发票摘要选择下),则您应该能够实现预期的目标结果。 PS。我将Location添加到了SalesInvoice对象本身上,而不是添加到了BillingSettings对象上:

Adding the Location field

第二个请求,扩展的端点包括添加的Location字段:

{
   "Type": {
      "value": "Invoice"
   },
   "CustomerID": {
      "value": "ABARTENDE"
   },
   "Date": {
      "value": "5/10/2019"
   },
   "Description": {
      "value": "Test SalesInvoice Creation"
   },
   "Location" : {
        "value" : "VEGAS"
    }
}

第二响应:

{
    "Amount": {
        "value": 0
    },
    "Balance": {
        "value": 0
    },
    "BillingSettings": {
        "BillToAddressOverride": {
            "value": false
        },
        "BillToContactOverride": {
            "value": false
        }
    },
    "Currency": {
        "value": "USD"
    },
    "CustomerID": {
        "value": "ABARTENDE"
    },
    "Date": {
        "value": "2019-05-10T00:00:00+00:00"
    },
    "Description": {
        "value": "Test SalesInvoice Creation"
    },
    "DueDate": {
        "value": "2019-06-09T00:00:00+02:00"
    },
    "Hold": {
        "value": false
    },
    "Location": {
        "value": "VEGAS"
    },
    "ReferenceNbr": {
        "value": "AR006994"
    },
    "Status": {
        "value": "Balanced"
    },
    "Type": {
        "value": "Invoice"
    }
}

对于CustomerLocation是否具有任何有意义的值/用途,我不确定,因此我将其保留在BillingSettings中。