Closed bleepsandblops closed 8 months ago
So I would suggest changing your payload to include the correct Guzzle payload, including json
. We just don't include this to add flexibility with the payload to include form_params
as an alternative for example.
$payload = [
'json' => [
'includeDetailedScans' => true,
'trackingInfo' => [
[
'trackingNumberInfo' => [
'trackingNumber' => 'xxxxxxxxxxxxxxxxxxxx',
]
]
]
]
];
But we could probably pass in the correct header as well - I'll look into that. But this would still be considered the correct payload format according to Guzzle.
@engram-design that worked thanks! You also solved another issue I had with sending multipart
so that should do the trick as well. Thanks!
Edit: the multipart
is for the Trade Documents Upload API, have created an issue #9
Describe the bug
Using the newly added Fedex client, I am getting this back from the API:
UNSUPPORTED.MEDIA.TYPE.ERROR
.See details below:
Steps to reproduce
Create the fedex client and connect - all fine.
In a plugin, do:
$data = Consume::$plugin->getService()->fetchData('fedex', 'POST', '/track/v1/trackingnumbers', $payload);
with $payload being:with XXX being a valid tracking number.
Error in the logs:
Now if you use Guzzle instead and do this with the same payload:
You get the correct response, no error.
Is it the
Content-Type' => 'application/json
that's missing in the Consume call?Craft CMS version
4.4.16.1
Plugin version
1.0.8
Multi-site?
No
Additional context
No response