Afternoon all. Any ideas why the following post w...
# cfml-general
d
Afternoon all. Any ideas why the following post would work find in Postman but pasting that same json payload body into a cfhttp request fails? WORKS FINE
Copy code
curl --location --request POST '<https://apis-sandbox.fedex.com/track/v1/trackingnumbers>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN_HERE' \
--data-raw '{
    "trackingInfo": [
        {
            "trackingNumberInfo": {
                "trackingNumber": "123456789012"
            }
        }
    ],
    "includeDetailedScans": true
}'
ERRORS OUT “422 Unprocessable Entity” with this error resp: {“transactionId”:“36d89e9d-dcef-480f-8abc-315f8e3aa5e3",“errors”[{“code”“INVALID.INPUT.EXCEPTION”,“message”:“Invalid field value in the input”}]}
Copy code
http url="<https://apis-sandbox.fedex.com/track/v1/trackingnumbers>" method="POST" result="resp_track" {
	httpparam type="header" name="Content-Type" value="application/json";
	httpparam type="header" name="Authorization" value="Bearer TOKEN_HERE";
	httpparam name="body" value='{"trackingInfo":[{"trackingNumberInfo":{"trackingNumber":"123456789012"}}],"includeDetailedScans":true}';
}
d
Not familiar w any of this, but is that Authorization value legit? TOKEN_HERE? No idea why Postman and cfhttp act differently, unless it's that you're not seeing the actual failure that's still happening there.
d
Yea, I just dropped the token for readability sake.
d
understood, I'll back away now 🙂
😂 2
d
Also note… I can technically use cfexecute (just tested successfully using that same curl cmd), just not as elegant. Just not sure what the issue is with that body when using in http script and tag
r
Shouldn't it be type="body", not name="body"?
👍 1
👍🏻 1
s
http status 400+ likely credential access to data requested problem… who you are or what you are requesting is the bearer token “nice” letters and numbers only
d
@Rodney DOH! You’ve right!! Wow…. It’s not like haven’t used this tag for years? Thanks for your eagle eye!
👍🏼 1
👍 1