Hello, Makers
I'm encountering some difficulties trying to input cURL code into an HTTP module (see below).
bash
curl --location ‘<a href="https://api.shipday.com/orders/query" rel="noopener nofollow ugc"> https://api.shipday.com/orders/query</a>’
–header ‘Content-Type: application/json’
–header ‘Authorization: Basic MY.API.GOES.HERE’
–data '{
“startTime”: “2023-11-28T00:00:00Z”,
“endTime”: “2023-12-04T00:00:00Z”,
“startCursor”: 1,
“endCursor”: 2
'
Here is the output:
A status code of 200 indicates a successful execution, but it hasn't retrieved my test order or any associated details. If I use this alternative code:
bash
curl --location ‘<a href="https://api.shipday.com/orders/FAR" rel="noopener nofollow ugc"> https://api.shipday.com/orders/FAR</a> FUTURE’
–header ‘Authorization: Basic MY.API.GOES.HERE’
This successfully finds the order, and as you can see from the data, it contains the information I need to retrieve:
I've spent several hours on this and would greatly appreciate any advice or insights.
Cheers everyone!
It appears the data is returned as an array. You may need to configure "Parse response" to "No" and then utilize a "Parse JSON" module with the data.
Hi Aidan,
Do you happen to have the Integromat Chrome extension? It can help you see precisely what data you're sending and receiving in responses. Could you also examine the response headers for any extra information?
Based on your screenshot, it appears you're receiving an empty array. The most likely reason is that the request parameters aren't being sent in the expected format, leading the query to return no results.
Hello,
Thanks for responding. Here are all the outputs:
json
[
{
“statusCode”: 200,
“headers”: [
{
“name”: “date”,
“value”: “Fri, 01 Dec 2023 08:50:48 GMT”
},
{
“name”: “content-type”,
“value”: “application/json;charset=UTF-8”
},
{
“name”: “transfer-encoding”,
“value”: “chunked”
},
{
“name”: “connection”,
“value”: “close”
},
{
“name”: “vary”,
“value”: “origin,access-control-request-method,access-control-request-headers,accept-encoding”
},
{
“name”: “x-content-type-options”,
“value”: “nosniff”
},
{
“name”: “x-xss-protection”,
“value”: “1; mode=block”
},
{
“name”: “cache-control”,
“value”: “no-cache, no-store, max-age=0, must-revalidate”
},
{
“name”: “pragma”,
“value”: “no-cache”
},
{
“name”: “expires”,
“value”: “0”
},
{
“name”: “x-frame-options”,
“value”: “DENY”
},
{
“name”: “content-encoding”,
“value”: “gzip”
}
],
“cookieHeaders”: <span class="chcklst-box fa fa-square-o fa-fw"></span>,
“data”: “<span class="chcklst-box fa fa-square-o fa-fw"></span>”,
“fileSize”: 2
}
]
I don't use Chrome, but I have downloaded it with the extension, and it doesn't seem to connect properly when running the scenario.
Here's a thought: could you verify if the HTTP module is sending the payload as {body: {data: {"whatever the query is"} } }
or if the data
key is absent?
Please examine the Request body; I suspect the problem lies there.
Request body:
json
{
"startTime": "2023-11-28T00:00:00Z",
"endTime": "2023-12-04T00:00:00Z",
"startCursor": 1,
"endCursor": 2
}
Try building it into this:
json
{data: { "startTime": "2023-11-28T00:00:00Z", "endTime": "2023-12-04T00:00:00Z", "startCursor": 1, "endCursor": 2} }
Hi there,
I noticed you're using the GET method for your API call, but the documentation specifies the POST method.
Kindly update the method to POST and remove your recent comment as it contains your secret API key.
If you need further assistance, feel free to contact us.
MSquare Support
Visit us here
Youtube Channel
I attempted that initially, but it only resulted in a 400 error with the following data:
json
{
"timestamp": "Dec 1, 2023, 12:14:17 PM",
"status": 400,
"error": "Bad Request",
"path": "/orders/query"
}
It appears the response remains consistent.
Hi there,
Please ensure you are using the POST method as detailed in the API documentation. This is the correct method to use.
A 400 error typically indicates an issue with the request itself.
To help identify the problem, please follow these steps:
- Execute the module using the POST method and examine the request body in your browser's DevTools (within the Integromat/callin.io interface).
- Open a duplicate browser tab and use the "List Orders" module from Shipday to inspect its request body in DevTools.
- Compare the request bodies from both operations. This comparison should reveal what is incorrect with your request.
Alternatively, you can utilize the "List Orders" module from Shipday instead of making a direct API call.
Should you need further assistance, please feel free to contact us.
MSquare Support
Visit us here
Youtube Channel