Getting curl to work in MAKE

Hello, Makers

I have curl code I am trying to input on a HTTP module but I am having difficulties (see below)

curl --location ‘https://api.shipday.com/orders/query
–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:

Code 200 means that it has successfully ran, but it has not pulled my test order or any details from it. If I use this code instead:

curl --location ‘https://api.shipday.com/orders/FAR FUTURE’
–header ‘Authorization: Basic MY.API.GOES.HERE’

This manages to find it just fine; and you can see the data has the info I need to pull:

I’ve been pulling teeth for a few hours now so some advice and/or insight would be a massive help.

Cheers guys!

You need to scroll down and select “Parse response: Yes

Screenshot_2023-11-30_091113

Currently you have it set to “No” (false)

8fa9a3307fba156d1e058030b9cd43c4ff7e52f9

3 Likes

Thanks for helping out on this one! Sadly the data remains empty regardless:

I had it turned off so I could check the output for data slightly faster.

Looks like data returns an array, so you might need to set “Parse response” to “No”, and use a “Parse JSON” module with the data instead…

3 Likes

No joy here either:


Running it through postman shows that it is properly working however:

It’s a tricky one!

Hi Aidan,

do you have the Integromat chrome extension by any chance? You can use it to see exactly what you are sending and what you are getting as a response. Can you also check the headers in the response? Maybe there is some additional info there.

From your screenshot it looks like you are getting an empty array as a response, so best guess - the request parameters are not being sent in the expected format, so the query is not returning anything.

3 Likes

Hello, Stoyan

Thanks for responding. Here are all the outputs here:

[
{
“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”: ,
“data”: “”,
“fileSize”: 2
}
]

I dont use chrome but have downloaded it with the extension but does not seem to properly connect when running the scenario.

OK here is a wild guess: can you check if the HTTP module is sending {body: {data: {“whatever the query is”} } } or if its missing the “data” part?

2 Likes

Check the Request body, I think that is where the issue is.

3 Likes

Request body:

{ “startTime”: “2023-11-28T00:00:00Z”, “endTime”: “2023-12-04T00:00:00Z”, “startCursor”: 1, “endCursor”: 2}

Try making it in to this:

{data: { “startTime”: “2023-11-28T00:00:00Z”, “endTime”: “2023-12-04T00:00:00Z”, “startCursor”: 1, “endCursor”: 2} }

3 Likes

Hi @AidanMAYFAIR

I could see that you are using GET method for your api call. While on the documentation it is POST method.

Please update the method to POST and delete your last comment ASAP as it contains your secret API key

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel

3 Likes

I had tried that originally but it only comes with an error 400 and:

Data:
{
“timestamp”: “Dec 1, 2023, 12:14:17 PM”,
“status”: 400,
“error”: “Bad Request”,
“path”: “/orders/query”
}

It seems that the response is the same

Hi @AidanMAYFAIR

Please use POST method as it explained in API documentation. So it is the correct method.
However, 400 request occurs when something wrong happens with request.

So first identify what is wrong with the request. To do so, please follow the step:

  1. Run the module with POST method and check the request body in Devtool (Integromat)
  2. Duplicate the tab and use module “list orders” from shipday to check the request body in Devtool

Screenshot 2023-12-01 183956

  1. Compare both the requests and you will get to know what’s wrong with your request.

You can also proceed with “List Orders” module from shipday instead of API call.

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel

2 Likes

I can replicate how the Shipday module works in HTTP but the issue is that it can only find “current” orders. Any orders I schedule in the future doesnt count as an “order” and it cannot be detected. I have booked a consultation with your company because my brain has melted