Connecting to the FedEx REST API

I don’t know anything about oauth2, rest services, etc. I’m just learning as I go! I’m sure I have more that 1 issue in my HTTP node parameters. Here’s a screenshot of the endpoint (I tried adding the link here but it didnt work, your probably have to have an account setup to see it)

I tried changing “Specify Query Parameters” from “Using Fields” to “Using JSON” and copied the JSON from the FedEx link above and that didn’t work either.

Describe the problem/error/question

I’m trying to connect to the FedEx API to track packages.

What is the error message (if any)?

“We do not support the content type in your request. Please modify the format and try again.”
(I don’t know what content type is or what it means)

Please share your workflow

I just have a Credential (see screenshot) and an HTTP request node (below screenshot).

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
{
“meta”: {
“instanceId”: “e99ef3f416b523c98a1235b464f9d611b55de95c706851fe3b121260e8e658b3”
},
“nodes”: [
{
“parameters”: {
“method”: “POST”,
“url”: “https://apis-sandbox.fedex.com/track/v1/trackingnumbers”,
“authentication”: “genericCredentialType”,
“genericAuthType”: “oAuth2Api”,
“sendQuery”: true,
“queryParameters”: {
“parameters”: [
{
“name”: “trackingNumber”,
“value”: “772418361814”
}
]
},
“options”: {}
},
“id”: “41baf76d-8473-4909-ac21-ff17e297038f”,
“name”: “HTTP Request”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.1,
“position”: [
880,
320
],
“credentials”: {
“oAuth2Api”: {
“id”: “3”,
“name”: “FedEx API”
}
}
}
],
“connections”: {}
}

Share the output returned by the last node

{
“status”:“rejected”,
“reason”:{
“message”:“415 - “{"transactionId": "409e6be5-aae3-48f6-88a8-30529f37d3bf","errors":[{"code":"UNSUPPORTED.MEDIA.TYPE.ERROR","message":"We do not support the content type in your request. Please modify the format and try again."}]}””,
“name”:“Error”,
“stack”:“Error: 415 - “{"transactionId": "409e6be5-aae3-48f6-88a8-30529f37d3bf","errors":[{"code":"UNSUPPORTED.MEDIA.TYPE.ERROR","message":"We do not support the content type in your request. Please modify the format and try again."}]}” at createError (/usr/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at RedirectableRequest.handleResponse (/usr/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:238:9) at RedirectableRequest.emit (node:events:525:35) at RedirectableRequest.emit (node:domain:489:12) at RedirectableRequest._processResponse (/usr/lib/node_modules/n8n/node_modules/follow-redirects/index.js:356:10) at ClientRequest.RedirectableRequest._onNativeResponse (/usr/lib/node_modules/n8n/node_modules/follow-redirects/index.js:62:10) at Object.onceWrapper (node:events:628:26) at ClientRequest.emit (node:events:525:35) at ClientRequest.emit (node:domain:489:12) at HTTPParser.parserOnIncomingClient (node:_http_client:693:27) at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17) at TLSSocket.socketOnData (node:_http_client:534:22) at TLSSocket.emit (node:events:513:28) at TLSSocket.emit (node:domain:489:12) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at TLSSocket.Readable.push (node:internal/streams/readable:228:10) at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23)”
}
}

Information on your n8n setup

  • n8n version: Version 0.227.1
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): App
  • Operating system: Linux Ubuntu

Hi @tberneman, I am very sorry you’re having trouble.

Edit: Nevermind, I previously wrote rubbish here. We are in fact using application/x-www-form-urlencoded here seems to be expected by Fedex.

Is the authentication working for you outside of n8n using curl for example? If so, can you share the requests you’re making during the OAuth2 process (of course with any secrets redacted)?

Or is the OAuth authentication process actually working in n8n and the error only is thrown when actually fetching tracking data?

1 Like

All oauth2 authorization request bodies are currently using application/x-www-form-urlencoded. So, authorization requests are definitely working.
Perhaps issue here is that you are not setting the request body as expected by the docs, and sending query-parameters instead, which seems incorrect according to the docs.

Can you try this node instead:

2 Likes

That node worked! I will look at what you did and learn from it.

Thank’s so much @MutedJam and @netroy!

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.