GET request with body/payloads

Hi,
I am trying to set a custom app and one of the endpoint require a GET request with a body.
I set everything apparently right in the custom app’s module page, but when I test it, the request appear to be empty, I checked with the Intergomat DevTools.

Doing the same request with an external api client (Insomnia) I got a response, but within Make I don’t and the request appears empty.

What did I do wrong?

Something is wrong with how it’s being formed. How about sharing some code? Screen shots.

1 Like

Sure!
Here’s the code from the custom app:

{
	"url": "/trackDelivery",
	"method": "GET",
	"qs": {},
	"body": {
		"deliveryNote": "{{parameters.deliveryNote}}",
		"courier": "{{parameters.courier}}",
		"deliveryDate": "{{parameters.deliveryDate}}"
	},
	"headers": {
		"Authorization": "Bearer {{connection.accessToken}}"
	},
	"response": {
		"response": "{{body}}",
		"error":{
      "type": "RuntimeError",
      "message": "[{{statusCode}}] \nCode:{{body.errorFieldCode}}, Type:{{body.errorTypeCode}}\n{{body.errorMessage}}"
    }
	}
}

And here’s the code generated by the module in production:

{
    "_engineData": {
        "calledAt": "Not available"
    },
    "response": {
        "status": 415,
        "headers": {
            "server": "nginx",
            "date": "Fri, 22 Apr 2022 06:14:03 GMT",
            "connection": "close",
            "content-length": "0"
        },
        "body": null,
        "_engineData": {
            "calledAt": "Not available"
        }
    },
    "request": {
        "url": "https://api.retelogisticastorage.it/api/externalServices/trackDelivery",
        "qs": {},
        "headers": {
            "user-agent": "Make/production",
            "authorization": "***"
        },
        "method": "GET"
    }
}

Is this the the correct base url and path?

https://api.retelogisticastorage.it/api/externalServices/

1 Like

Yes,
using Insomnia, with the same url, I am able to get a response from the server.

Is there a block on the make IP address maybe?

Also what is the authentication model?

1 Like

Authentication model is Oauth2, and it works fine for every other modules of the same app, which my scenarios use daily.

Since other modules from the same app and same API set work fine, I suppose there is no block on the Make IP address.

It really appears that for this module no body is created.

1 Like

Have you tried sending a static body? In your app to see What happens.

1 Like

How do you mean?

Set the app module with static elements? I tried, same results.

What headers are you setting in the Base @Giacomo_Lanzi ? Do your total headers match in the request from Insomnia to the Make request?

415 Unsupported Media Type

You need to be setting Content-Type, perhaps Content-Encoding. But you may also need to use the Type parameter in your module outside of the header info.

Start with getting the headers of the request to match.

On mobile, so I can validate the request later, but this needs to be output, not response:


	"response": "{{body}}",

It’s non-standard to include a body with a GET request, which makes me assume that the API might be a bit quirky to work with.

2 Likes

Hi Luke,
Thank you for the support. Here’s what I tried:

  1. Add Content-Type to the module’s headers (as is in Insomnia)
  2. Change the response to the basic one. The one I use and I shared before catches the server’s error to easily understand what is going on. It works in every other module in the same app, but I tried to take it simple as suggested

Nothing changes.
I didn’t understand where should I put the Type param you suggested. Every parameter used in the request has a declared type (all text). Could you be more specific?

Below, as reference, the edited request as appears in the custom app module’s page and as (not) appears in the raw code from dev tools.

Custom app’s module:

{
	"url": "/trackDelivery",
	"method": "GET",
	"qs": {},
	"body": {
		"deliveryNote": "{{parameters.deliveryNote}}",
		"courier": "{{parameters.courier}}",
		"deliveryDate": "{{parameters.deliveryDate}}"
	},
	"headers": {
		"Authorization": "Bearer {{connection.accessToken}}",
		"Content-Type":"application/json"
	},
	"content-type":"application/json",
	"response": "{{body}}"
}

Raw code:

{
    "_engineData": {
        "calledAt": "Not available"
    },
    "response": {
        "status": 500,
        "headers": {
            "transfer-encoding": "chunked",
            "content-type": "application/json; charset=utf-8",
            "server": "nginx",
            "date": "Sun, 24 Apr 2022 16:57:02 GMT",
            "connection": "close"
        },
        "body": {
            "errorFieldCode": "999",
            "errorTypeCode": "999",
            "errorMessage": "Generic Error"
        },
        "_engineData": {
            "calledAt": "Not available"
        }
    },
    "request": {
        "url": "https://api.retelogisticastorage.it/api/externalServices/trackDelivery",
        "qs": {},
        "headers": {
            "user-agent": "Make/production",
            "content-type": "application/json",
            "authorization": "***"
        },
        "method": "GET"
    }
}

As you can see, it appears as the module doesn’t even create a request body, the server response is a generic error, as should if body is empty/null.

Hope this clarify a bit more the situation.

@Giacomo_Lanzi I’ll check and respond soon. Can you include a screenshot of your headers in Insomnia and Chrome Dev from the request in Make?

Here a screenshot of the Headers data from Insomnia (There is no way to have a raw headers, as far as I know):

And here from dev tools:

EDIT
Since I tried also with Postman, below the log from successful request in PM:

GET /api/externalServices/trackDelivery HTTP/1.1
Authorization: Bearer ***
Content-Type: application/json
User-Agent: PostmanRuntime/7.29.0
Accept: */*
Postman-Token: eb65d083-ff70-46f6-9e49-77cd6c3f887d
Host: api.retelogisticastorage.it
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 83
 
{
"deliveryNote": "4076318260",
"courier": "DHL",
"deliveryDate": "2022-04-20"
}
 
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Content-Encoding: br
Server: nginx
X-Powered-By: PleskLin
Date: Mon, 25 Apr 2022 06:41:07 GMT
 
{"deliveryNote":"4076318260","trackingDetails":[{"code":"OK","description":"Spedizione Consegnata - Firmata da : ","date":"2022-04-21T14:44:00","notes":"Spedizione Consegnata - Firmata da : ","notFound":false,"internalStatus":2},{"code":"WC","description":"Spedizione in consegna","date":"2022-04-21T10:44:00","notes":"Spedizione in consegna","notFound":false,"internalStatus":1},{"code":"AR","description":"Spedizione arrivata - ROME-ITALY","date":"2022-04-21T10:02:00","notes":"Spedizione arrivata - ROME-ITALY","notFound":false,"internalStatus":14},{"code":"DF","description":"Spedizione in transito - ROME-ITALY","date":"2022-04-21T09:00:00","notes":"Spedizione in transito - ROME-ITALY","notFound":false,"internalStatus":14},{"code":"PL","description":"Spedizione in transito - ROME-ITALY","date":"2022-04-21T06:50:00","notes":"Spedizione in transito - ROME-ITALY","notFound":false,"internalStatus":14},{"code":"AF","description":"Spedizione in transito - ROME-ITALY","date":"2022-04-20T12:57:00","notes":"Spedizione in transito - ROME-ITALY","notFound":false,"internalStatus":14},{"code":"DF","description":"Spedizione in transito - CATANIA-ITALY","date":"2022-04-19T23:14:00","notes":"Spedizione in transito - CATANIA-ITALY","notFound":false,"internalStatus":14},{"code":"PL","description":"Spedizione in transito - CATANIA-ITALY","date":"2022-04-19T20:34:00","notes":"Spedizione in transito - CATANIA-ITALY","notFound":false,"internalStatus":14},{"code":"PU","description":"Spedizione ritirata","date":"2022-04-19T12:36:00","notes":"Spedizione ritirata","notFound":false,"internalStatus":0}]}
1 Like

So No matter what you send on the GET request you get a 500 error in make? And only on this particular GET end point ? The others work ok?

1 Like

I note in the make app dev console the Authorization: header is missing the Bearer string before the token. You do have it in your make app code but somehow it’s not making into the header? Can you confirm?

1 Like

Apparently, in Make, the header Authorization field appears fully hidden in the log, that happens with other modules of the same app. Below a screenshot of the same scenario with another GET module from the same app, as you can see, the field is identical in the log:

As for the first questions: This is the only endpoint that gives me problem with those API in Make. The module I added to compare the headers, uses also a GET request, but without body, so it’s not really comparable.

The endpoint trackDelivery is the only one that requires a GET req. and a proper body with arguments. I asked the service if I could use argument in the qs, but I got a negative answer.

That is a real puzzle to me! Also, since the endpoint is working using Postman or Insomnia, I believe the problem is not the API, but the app’s module not creating the body at all!

GET requests don’t usually have a body though. POSTs do. Semantically GET requests are allowed to have a body but they are never processed. See this post and references.

Now maybe Make specifically doesn’t send the body on purpose or by accident not sure but it does look like make throws away your body message as part of a GET.

Check the request body in the dev console to see if make app sends the body or not.

This may not fix your issue though and your api vendor may need to get you an alternative way to call this endpoint. Truly this should be done with query or path variable parameters.

1 Like

I know that GET requests aren’t suppose to have a body, but this what I have to work with, sadly.
I will ask the vendor if there is any other way for me to use the endpoint without body, but I don’t think that’ll be the case.

That’s a pity, since with this endpoint I could track the deliveries I made with their API.

As suspected, from the console, Make doesn’t send body, so there is no way it’ll work.

I kind of hoped there would be a way for me to send the GET req. with body, somehow.

EDIT:
There is a way: using a vanilla HTTP module.
But this brings me to a doubt: why Make doesn’t allow me to create a GET request with body for my apps, but allows me to do it with a HTTP module?

It will, if you can replicate it with HTTP, you can get it working with custom. It comes down to comparing the data to see what is missing. I’m mobile again, sorry I haven’t responded. Busy day! I’ll try to check back tonight, but feel free to harass me if I don’t get back with you.

Yeah the http app is always a workaround. I wonder if the custom app needs to do something special here. If anyone knows @luke.ifonly_solution will. At least you’re getting closer and that’s good.

1 Like