Skip to content
Getting curl to wor...
 
Notifications
Clear all

Getting curl to work in callin.io

16 Posts
4 Users
0 Reactions
5 Views
AidanMAYFAIR
(@aidanmayfair)
Posts: 8
Active Member
Topic starter
 

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!

 
Posted : 29/11/2023 4:33 pm
samliew
(@samliew)
Posts: 293
Reputable Member
 

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

Screenshot_2023-11-30_091113

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

8fa9a3307fba156d1e058030b9cd43c4ff7e52f9

 
Posted : 30/11/2023 1:39 am
AidanMAYFAIR
(@aidanmayfair)
Posts: 8
Active Member
Topic starter
 

Appreciate the assistance with this! Unfortunately, the data still appears empty:

I had it disabled to expedite checking the output for data.

 
Posted : 30/11/2023 8:15 am
samliew
(@samliew)
Posts: 293
Reputable Member
 

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.

 
Posted : 30/11/2023 8:52 am
AidanMAYFAIR
(@aidanmayfair)
Posts: 8
Active Member
Topic starter
 

No luck here either:

Running it through Postman shows that it is working correctly, however:

It’s a tricky one!

 
Posted : 30/11/2023 9:24 am
Stoyan_Vatov
(@stoyan_vatov)
Posts: 22
Eminent Member
 

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.

 
Posted : 30/11/2023 6:56 pm
AidanMAYFAIR
(@aidanmayfair)
Posts: 8
Active Member
Topic starter
 

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.

 
Posted : 01/12/2023 9:42 am
Stoyan_Vatov
(@stoyan_vatov)
Posts: 22
Eminent Member
 

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?

 
Posted : 01/12/2023 10:57 am
Stoyan_Vatov
(@stoyan_vatov)
Posts: 22
Eminent Member
 

Please examine the Request body; I suspect the problem lies there.

 
Posted : 01/12/2023 11:44 am
AidanMAYFAIR
(@aidanmayfair)
Posts: 8
Active Member
Topic starter
 

Request body:

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

 
Posted : 01/12/2023 11:49 am
Stoyan_Vatov
(@stoyan_vatov)
Posts: 22
Eminent Member
 

Try building it into this:

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

 
Posted : 01/12/2023 12:06 pm
Msquare_Automation
(@msquare_automation)
Posts: 88
Estimable Member
 

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

 
Posted : 01/12/2023 12:07 pm
AidanMAYFAIR
(@aidanmayfair)
Posts: 8
Active Member
Topic starter
 

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"
}

 
Posted : 01/12/2023 12:15 pm
AidanMAYFAIR
(@aidanmayfair)
Posts: 8
Active Member
Topic starter
 

It appears the response remains consistent.

 
Posted : 01/12/2023 12:15 pm
Msquare_Automation
(@msquare_automation)
Posts: 88
Estimable Member
 

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:

  1. Execute the module using the POST method and examine the request body in your browser's DevTools (within the Integromat/callin.io interface).
  2. Open a duplicate browser tab and use the "List Orders" module from Shipday to inspect its request body in DevTools.

Screenshot 2023-12-01 183956

  1. 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

 
Posted : 01/12/2023 1:16 pm
Page 1 / 2
Share: