API Call returning unreadable

Started by gmundt, April 10, 2026, 02:00:04 PM

Previous topic - Next topic

gmundt

I am trying to make an API call to FedEx rate quote.  The JSON works fine in Postman, but when I attempt it through the web/request I am getting unreadable response.

extrahdr$="Content-Type: application/json"+$0a$+"Authorization: Bearer MyToken"+$0a$+"Accept-Encoding: identity"

url$=https://apis-sandbox.fedex.com/rate/v1/rates/quotes

request$=
{
  "accountNumber":{
    "value":"740561073"
  },
  "requestedShipment":{
    "shipper":{
      "address":{
        "streetLines":["17841 FITCH"],
        "city":"IRVINE",
        "stateOrProvinceCode":"CA",
        "postalCode":"92614",
        "countryCode":"US"
      }
    },
    "recipient":{
      "address":{
        "streetLines":["7609 Geranium Street"],
        "city":"Bethesda",
        "stateOrProvinceCode":"MD",
        "postalCode":"20817",
        "countryCode":"US"
      }
    },
    "rateRequestType":["LIST"],
    "serviceType":"FIRST_OVERNIGHT",
    "preferredCurrency":"USD",
    "shipDateStamp":"2026-04-10",
    "pickupType":"DROPOFF_AT_FEDEX_LOCATION",
    "packagingType":"YOUR_PACKAGING",
    "requestedPackageLineItems":[
      {
        "groupPackageCount":"1",
        "weight":{
          "units":"LB",
          "value":"8"
        }
      }
    ]
  }
}

method$="POST"

call "*plus/web/request",url$,request$,rcv_data$,rcv_hdr$,"","",extrahdr$,method$

Since the header is returning HTTP/1.0 500 Internal Server Error and Content-Encoding is returning gzip I believe I have something incorrect in the heading.

 

James Zukowski

It looks like you're using HTTP 1.0. FedEx may be expecting 1.1.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

gmundt

I thought that call "*plus/web/request" defaulted to 1.1 and would need to update %web_request_http_ver$ to change it 1.0.

Devon Austen

Support for the use of HTTP version 1.1 protocol was added in PxPlus 2021 (v18.00).

If you are using an earlier version it is always using HTTP 1.0.
Principal Software Engineer for PVX Plus Technologies LTD.

gmundt

Okay, I'll have to see if FedEx supports 1.0 at the customer is on an older version of PxPlus.