Using search endpoint in batch

Hi all,

I try to use the “search” endpoint, inside a batch.

We used batch a lot before, it always works well.

But, for “search”, I don’t find any way to make it work.

When I use the regular method, that I think should work, I get that result:

var request = {
	"data": {
		"actions": [{
				"method": "get",
				"relative_path": "/workspaces/1206482253527890/tasks/search",
				"data": {
					"is_subtask": true,
					"modified_at.after": "2024-06-12T04:06:21.215Z"
				},
				"options": {
					"limit": 10,
					"fields": ["parent.modified_at", "modified_at", "created_at"]
				}
			}
		]
	}
}

response: “Values in "data" for batch GET actions cannot be arrays or objects.”

Then, I tried to set all parameters in “options” instead of data.
response: “You must specify at least one search filter.”,

3rd try, I tried to set search parameters in query (relative_path)
response: “Parameters are not accepted in a batch action’s path; use “data” or “options””

I don’t know what to try next!

The reason I try to use “batch” instead of direct GET, is because sometimes, I need to send very long query, like “projects.any=xxxx,yyyy, zzzz, …” that are too long for a regular querystring parameter, and are refused by the browser and/or api.
If I can send them using “post”, there’s no limit on the length of the parameters.

Oh, I was looking at the wrong place!

In that sample, I need to replace : true, with : “true” (true in string) !!!

That’s good to know…

And my first sample works as expected.

{
  "data": {
    "actions": [
			{
				"method": "get",
				"relative_path": "/workspaces/1206482253527890/tasks/search",
				"data": {
					"is_subtask": "true", <--- USING STRING FORMAT
					"modified_at.before": "2024-06-12T04:06:21.215Z"
				},
				"options": {
					"limit": 10,
					"fields": ["parent.modified_at", "modified_at", "created_at"]
				}
			}
    ]
  }
}
3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.