Webgility统一订单API错误-尝试取消引用空对象引用

时间:2019-05-20 16:57:50

标签: php api quickbooks

我正在尝试使用Unify Order APIWebgility进行编码。我正在使用

我已使用示例请求数据和php code并添加了令牌

 $url = 'https://unify.webgility.com/api/api/Orders';
 $Token='XXXXXXX';
 $data = '{
  "Orders": {
    "OrderId": "1010",
    "OrderDate": "2014-08-20",
    "Customer": {
      "FirstName": "Dan",
      "LastName": "Scheffler",
      "CompanyName": "ABC Corp.",
      "EmailAddress": "dans@abc.com"
    },
    "BillingAddress": {
      "FirstName": "Webgility",
      "LastName": "Inc",
      "AddressLine1": "2703 Town Center Lane",
      "AddressLine2": "Add2",
      "AddressLine3": "Add3",
      "AddressLine4": "Add4",
      "City": "Sunnyvale",
      "Region": "South",
      "PostalCode": "940862",
      "Country": "US"
    },
    "ShippingAddress": {
      "FirstName": "Dan",
      "LastName": "Scheffler",
      "AddressLine1": "511 Willson Lane",
      "AddressLine2": "Add2",
      "AddressLine3": "Add3",
      "AddressLine4": "AAA",
      "City": "Franklin",
      "Region": "Central",
      "PostalCode": "85061",
      "Country": "US"
    },
    "OrderItems": [
      {
        "SKU": "Book1",
        "Name": "Novel Book 1",
        "Description": "Qwertyuiop",
        "UnitPrice": 10,
        "UnitCost": 5,
        "Quantity": 1,
        "Taxable": false
      },
      {
        "SKU": "Book2",
        "Name": "Tech Book 2",
        "Description": "WE22222",
        "UnitPrice": 10,
        "UnitCost": 5,
        "Quantity": 1,
        "Taxable": false
      }
    ],
    "ShipmentStatus": "Shipped",
    "ShipmentMethod": "FedEx",
    "ShipmentCarrier": "Overnight",
    "ShippingCharges": 10,
    "ShippingCost": 10,
    "TotalDiscounts": 5,
    "TotalTax": 5,
    "TotalAmount": 30,
    "PaymentStatus": "Paid",
    "PaymentMethod": "Check",
    "PaymentNotes": "My Payment",
    "Notes": "My Notes",
    "Currency": "USD"
  }
 }';

 $ch = curl_init();
 curl_setopt($ch, CURLOPT_URL,$url);
 curl_setopt($ch, CURLOPT_TIMEOUT, 30000); //timeout after 30 seconds
 curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
 curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
 curl_setopt($ch, CURLOPT_USERPWD, $Token);
 curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 curl_setopt($ch, CURLOPT_HTTPHEADER, array(
 'Content-Type: application/json',
 'Token: ' . $Token
 ));
 $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);  // 0 
 $result=curl_exec ($ch);
 curl_close ($ch);

结果消息始终返回:

An  
Please contact Support: support@webgility.com or (877) 753-5373 ext.3

Webgility支持人员几乎不知道他们拥有API,而我尝试联系开发人员的尝试均未成功-显然他们根本不会说英语。有人使用过此“服务”吗?

0 个答案:

没有答案