Forum Academy Marketplace Showcase Pricing Features

How to get data back from a POST request?

Hi everyone,

I’m trying to use the Keywords Everywhere API to get Google search volume data back for certain keywords.

I have it almost set up, but when I initialize it in the API plugin tool, the data field I get back is empty.

In the documentation that they provide on Keywords Everywhere, the field to send a keyword through is an array of strings type, “kw[]”.

I think that’s where I’m messing up.

Below is how I currently have it set up. Any ideas why I’m getting empty data back?

The kw part should be

...: "gkp",
"kw":["taylor swift"]
}

Also, set a headers key
Content-type
with value to application/json

Thanks for the tip @Jici . I still don’t get any data back though :confused:

Here’s my new setup and the response I still get when I try to initialize:

Any other ideas?

This is probably because there’s no response/data
It’s hard to know, but you should test with the example they give

{
	"dataSource": "gkp",
	"country": "us",
	"currency": "USD",
	"kw": [
		"keywords tool",
		"keyword planner"
	]
}

And check if you get a better result in your request

Still nothing:

Really appreciate you taking the time to help. If you have other ideas, I’m all ears. I’ve also written to the Keywords Everywhere team to see if they have any insight.

Instead, try that
Delete header content-type (I think finally that they expect data in query string)
Delete the json body and Add this to the JSON body
dataSource=gkp&country=us&currency=USD&kw[]=keywords tool&kw[]=keyword planner

Like this? Getting an error about the header. I tried changing the body type from JSON to form-data, raw, and JSON and got this same error each time.

Create a fresh new API Call. Bubble have an issue sometimes with deleted header

Back to getting an empty response:

I have tested with importing the call in postman like they suggest
Can you add headers:
Content-type application/x-www-form-urlencoded
Accept application/json

You can also try to delete the body and set it using parameter like you did on the first try. Just keep the same content type header. A good tool to use to check the output of your requests if requestbin.com. You can inspect the call and check if this match what API Provider expect.

If this don’t work, maybe you should ask the API provider to see what you are doing wrong. It will be hard for someone else to test because the API seem to request credits to run the call.

2 Likes

YES!

1 Like

For anyone stumbling across this later, here’s what my final set up looks like for initializing the Keywords Everywhere API for the Get Keyword Data endpoint. You have to also set up the API (shown in the original question) before setting up this particular call.

@Jici Is there any resource you recommend for understanding what that extra parameter is doing or why the JSON body is structured like that?

In fact, Bubble may not call the Body a json one because you can also add url parameters like you did for this case.

Bubble have some strange behavior in API depending on how you set header or parameters / body.
So for example, the original request you made probably get encoded in json. But the API expect form encoded. So it didn’t work. Like when we test using a json body.
Even if you put the content type header to form encoded, Bubble will overide it. But if you put querystring, it will not be the case. But the ouput is a little bit different too.

Maybe someday I will create a video to show how all different behavior in Bubble API Connector when using json as body type

1 Like

Hey @Jici,

I’m stuck again, this time on how I can add a parameter so that I could pass a user input from the front end of my app through to the Keywords Everywhere API.

You saw the working set up above, but when I try to add a variable field, it doesn’t work.

Any ideas how this should be set up so that I have a keyword field I can dynamically pass data through to from my app?

You should use dynamic value inside the body
like ...&kw[]=<keyword>
If you need to add more than one, you might consider using
&<keywords> and use a list with :formatted as text. In the first part you will use kw[]=Current text and the join with you use &

Or use &kw[]=<keywords> and in dynamic value use join with “&kw[]=”

Both option should work

1 Like