Hi,
I am trying to build a custom app but I face an issue with one of my query string element.
The parameter key is “q[s]” for sorting. I face no error when using it but this parameter is not taken into account.
I guess it is because of the brackets.
I tried encoding the bracket but no luck either.
Here is my trigger module “Communication” json:
{
// Request to API endpoint
"url": "/users", // Relative to base URL
"method": "GET",
"headers": { }, // Additinal HTTP headers
"qs": { // Query string
"per": "50"
},
"pagination": {
"qs": {
"page": "{{pagination.page}}",
"q[s]": "created_at+desc"
}
},
// Response handling
"response": {
// Splits the array from API response into bundles.
// See documentation at: https://docs.integromat.com/apps/app-blocks/api/pagination
"iterate": "{{body.data}}", // Iterates "users" array from API response to split it into individual items.
// New items search specification
// See documentation at: https://docs.integromat.com/apps/app-structure/modules/trigger#response.trigger
"trigger": {
"type": "date", // Identifies trigger polling by date.
"id": "{{item.id}}", // Identifies items by its property: "id".
"date": "{{item.attributes.created_at}}", // Identifies items by its property: "created" date.
"order": "asc" // Specifies in what order the remote API returns items.
},
"output": "{{item}}", // Outputs whole each iterated "item" object as separate bundle.
"limit": "{{parameters.limit}}" // Limits number of output bundles as requested by user (even if API returns more items).
}
}
I’m not sure if using square brackets in a key is even allowed, this is completely not what anyone would expect given that square brackets are reserved characters that denote the start and end of an array.
Give these a try instead and let me know if they work or don’t:
I already tried escaping the bracket but I have a “Invalid escape character in string.json(261)” error in the web editor preventing me from saving the changes.
For your second proposition I am also having an error in the editor: “Expected comma”.
The “Expected comma” error is because in the json array it’s expecting a flat array of values or an array of objects "q": [{"s":"created_at+desc"}] etc
Without seeing your custom app it’s hard to know the best way forward tbh.
What I can tell you is that using GET requests in Make it will translate any querystring element unless you put it directly into the url rather than a QS field in a component. Not sure if it’s related to your issue but thought it worth mentioning.
@Simon_Langham Actually it is quite helpful in my case. As my query string element is static I can pass it directly in the url rather than using the “qs” attribute.
For anyone facing the same issue in the future, I moved from the following config: