This error has plagued me for about a week now... I'm trying to create a shipment in Ebay but I'm getting a 500 error code in the response. Here is a link to the documentation https://developer.ebay.com/api-docs/sell/fulfillment/resources/order/shipping_fulfillment/methods/createShippingFulfillment
I'm running this code in the production environment:
@header = {
'Content-Type': 'application/json',
'Authorization': "Bearer #{@token}"
}
uri = URI.parse("https://api.ebay.com/sell/fulfillment/v1/order/#{order.order_number}/shipping_fulfillment")
# Create the HTTP objects
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
items = []
order.items.each do |i|
items << {"lineItemId": i[:id]}
end
params = {
"lineItems": items,
"shippedDate": Time.parse(date).strftime("%Y-%m-%dT%H:%M:%S.000Z"),
"shippingCarrierCode": "USPS",
"trackingNumber": tracking_number
}
request = Net::HTTP::Post.new(uri.request_uri, @header)
request.body = params.to_json
response = http.request(request)
puts response.code #prints 500
My Error:
{"errors": [{
"errorId": 2003,
"domain": "ACCESS",
"category": "APPLICATION",
"message": "Internal error",
"longMessage": "There was a problem with an eBay internal system or process. Contact eBay developer support for assistance",
"parameters": [{
"name": "reason",
"value": "Failed to transform underlying error response, see logs."
}]
}]}
I paid for the premium developer support and I've yet to receive a response. Any help would be greatly appreciated. I've tried submitting the same request with an empty body but that doesn't change the response. I have also tried changing the headers. If I add 'Accept': 'application/json'
, then I get a 500 error with an empty body. It doesn't make any sense.
UPDATE
From the suggestions in the comments, I have tried changing the params hash to:
params = {
"lineItems": "[{\"lineItemId\":10025031700524,\"quantity\":1}]",
"shippedDate": "2020-05-01T08:05:00.000Z",
"shippingCarrierCode": "USPS",
"trackingNumber": "9400111899562795104724"
}
I have also tried running subsequent requests. I have also tried submitting the following JSON in the body:
request.body = {
"lineItems": [
{
"lineItemId": "10025031700524",
"quantity": "1"
}
],
"shippedDate": "2020-05-01T08:05:00.000Z",
"shippingCarrierCode": "USPS",
"trackingNumber": "9400111899562795104724"
}.to_json
Each of these attempts produces the exact same error as before. I've tried changing the quantity to an integer & string as well.
UPDATE 2
Here are the contents of my request:
POST /sell/fulfillment/v1/order/24-04954-08727/shipping_fulfillment
content-type: application/json
authorization: Bearer v#i^1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
accept-encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
accept: */*
user-agent: Ruby
connection: close
host: api.ebay.com
content-length: 159
content-type: application/x-www-form-urlencoded
{"lineItems":[{"lineItemId":"10025031700524"}],"shippedDate":"2020-05- 01T08:05:00.000Z","shippingCarrierCode":"USPS","trackingNumber":"9400111899562795104724"}