API connector request body GET requests?

Hey bubblers,

I’m working on querying our elastic search Database using the API connector.

Elastic search recommends using request body get requests, but I can’t seem to find out if this is supporter by bubble and if so, how to do it.

I can get basic data back using query string in the URL, but can’t get the data I need this way.

Any contents would be greatly appreciated.

1 Like

Yes this si supported.
You can use different way like using parameters, json body and setting param=&param2= or use in the link ?param=[params]&params2=[params2] … this depend of the API you are calling.

So can I do nested response body queries?

GET /twitter/_search

{
“query” : {
“term” : { “user” : “kimchy” }
}
}

Yes. If you provide link to api endpoint, it will be easier to help.
but in your case, if this is json
you will set this like that:

{
“query” : {
“term” : { “user” : “<user>” }
}
}

@Jici How do you produce that structure in the API connector though?

The way I show you.
Maybe you can provide screenshot of your setting

Your call is a GET so it won’t allow your to POST a json. Normally a GET request use url parameter. Do you have any API doc? In some case, the request quand use a form like
url?query={json payload}

That is my questions, how to use nested params in a GET request.

I am using elastic search https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html#search-search-api-request-body

According to this link. You can do both. GET or POST
if you switch to POST, you will have json body

oh yes, you are right! I missed that, thanks. Let me test a few things with Post.

If you use GET /twitter/_search?q=user:kimchy
If you use POST, I suggest to use
{
“query” : {
“term” : { “user” : “kimchy” }
}
}

Still seam to have an issue? I am getting this error:

There was an issue setting up your call.

undefined error: this header name is not correct undefined

Did you solve this?