Why does returning just the ID from a search fails?

Dear all =)

Can someone figure out why I am getting

{"statusCode":400,"error":"Bad Request","message":"[request query.fields]: could not parse array value from json input"}

when I search for a specific rule

base="https://example.com/"
space="myspace"
name="nametest3"

url="${base}s/${space}/api/alerting/rules/_find?per_page=1000&search_fields=name&search=${name}&fields=id"

It complains about fields=id, but it works when I search for all rules

base="https://example.com/"
space="myspace"
url="${base}/s/${space}/api/alerting/rules/_find?per_page=1000&fields=name&fields=id"

Link to the API.

Question

What am I doing from in the first case?

Hugs,
Sandra =)

Hey @Sandra_Schlichting ,

I see the request schema for this route requires fields to be an array, have you tried something like this?

curl -X GET -u elastic -g "localhost:5601/s/myspace/api/alerting/rules/_find?per_page=1000&search_fields=name&search=nametest3&fields=[\"id\"]"

Best,
Oleg

1 Like

That worked. Thanks a lot!! =)

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