fillup / walmart-partner-api-sdk-php

PHP client for Walmart Partner APIs
MIT License
37 stars 51 forks source link

BadRequest from Shipping API #81

Open rcholic opened 3 years ago

rcholic commented 3 years ago

I realized this question has been asked in another thread from 2016, but my issue seems different, because I am POSTing JSON to the Ship Order API. I compared my JSON and the examples in the API doc, and their structure and data types look identical.

When I post my JSON, I got error code 400 for BadRequest. Can anyone help me spot where could be wrong?

My JSON:

{
  "orderShipment": {
    "orderLines": {
      "orderLine": [
        {
          "lineNumber": "1",
          "sellerOrderId": "23211",
          "orderLineStatuses": {
            "orderLineStatus": [
              {
                "status": "Shipped",
                "statusQuantity": {
                  "unitOfMeasurement": "EACH",
                  "amount": "1"
                },
                "trackingInfo": {
                  "shipDateTime": 637449042980494000,
                  "carrierName": {
                    "otherCarrier": null,
                    "carrier": "USPS"
                  },
                  "methodCode": "Express",
                  "trackingNumber": "940010920556823783126",
                  "trackingURL": "https://www.walmart.com/tracking?tracking_id=940010920556823783126&order_id=38073367771"
                },
                "returnCenterAddress": {
                  "name": "Test1",
                  "address1": "Walmart Warehouse 1",
                  "address2": null,
                  "city": "Redmond",
                  "state": "WA",
                  "postalCode": "98052",
                  "country": "USA",
                  "emailId": "xxxx1@gmail.com",
                  "dayPhone": "123456789"
                }
              }
            ]
          }
        }
      ]
    }
  }
}

The JSON in the Walmart Marketplace API doc:

{
  "orderShipment": {
    "orderLines": {
      "orderLine": [
        {
          "lineNumber": "1",
          "sellerOrderId": "92344",
          "orderLineStatuses": {
            "orderLineStatus": [
              {
                "status": "Shipped",
                "statusQuantity": {
                  "unitOfMeasurement": "EACH",
                  "amount": "1"
                },
                "trackingInfo": {
                  "shipDateTime": 1580821866000,
                  "carrierName": {
                    "otherCarrier": null,
                    "carrier": "UPS"
                  },
                  "methodCode": "Standard",
                  "trackingNumber": "22344",
                  "trackingURL": "http://walmart/tracking/ups?&type=MP&seller_id=12345&promise_date=03/02/2020&dzip=92840&tracking_numbers=92345"
                },
                "returnCenterAddress": {
                  "name": "walmart",
                  "address1": "walmart store 2",
                  "address2": null,
                  "city": "Huntsville",
                  "state": "AL",
                  "postalCode": "35805",
                  "country": "USA",
                  "dayPhone": "12344",
                  "emailId": "walmart@walmart.com"
                }
              }
            ]
          }
        }
      ]
    }
  }
}