How to GET info from Bubble database using API call?

Struggling to make this work, inside of a Chrome extension.

My POST requests are working fine. Can’t figure out the GET side of things.

Basically, for each User created? There is a particular field that I want to be able to GET – for each currently logged in user: “PaidSubscription”, which can be either a “yes” or a “no”.

Here’s what I’ve attempted:

function TestingGetRequest() {
var email = “fakeuseremail@gmail.com”;
var password = “fakepassword69”

const req = new XMLHttpRequest();
const baseUrl = “https://myappname.bubbleapps.io/version-test/api/1.1/obj/allusers/paidsubscription”;
const urlParams = email=${email}&password=${password};

req.open(“GET”, baseUrl, true);
req.setRequestHeader(“Content-type”, “application/x-www-form-urlencoded”);
req.send();

alert(req.responseText);
}

What am I getting wrong here?

Basically what I want to do, for each user? Just find out if they’re a paid subscriber or not. And basically get that “yes” or “no” status for each member, so I can modify the user experience based on their status.

Thanks!

One silly mistake I made? Not checking the data types I wanted exposed via the Bubble API. So I wasn’t aple to access any of them. I kept getting a 404 Data Type Not Found error. That was why.

Here’s the working version of where I’m at on this, which successfully DOES allow me to GET some list of data types.

var xhr = new XMLHttpRequest();

xhr.onreadystatechange = function() {

if (xhr.readyState == XMLHttpRequest.DONE) {

    alert(xhr.responseText);

}

}

xhr.open('GET', 'https://myappname.bubbleapps.io/version-test/api/1.1/obj/user', true);

xhr.send(null);

Next step from here? Instead of the whole list, access only one entry. Then just get the value for one column within that one entry.

I can think of a wonky, awful workaround method of doing this, where I’d get the full list, cross-reference it against the current entry I’m looking for, and find it THAT way, outside of the GET request. However there has GOTTA be a way to simplify this and do it INSIDE of the GET request. That’s my next step here.

More progress: Figured out how to extract one specific value, FOR one specified user:

function TestingGetRequest() {

var xhr = new XMLHttpRequest();

xhr.onreadystatechange = function() {

if (xhr.readyState == XMLHttpRequest.DONE) {

    var fullresponse = xhr.responseText;

    var obj = JSON.parse(fullresponse);

    // alert(xhr.responseText);

    // alert(fullresponse);

    alert(obj.response.PaidSubscription);

}

}

// xhr.open('GET', 'https://myappname.bubbleapps.io/version-test/api/1.1/obj/feedback', true);

// above version gives ALL results of that type

xhr.open('GET', 'https://myappname.bubbleapps.io/version-test/api/1.1/obj/user/1662320076289x150834354145735100', true);

// above version lasers in on ONE SPECIFIC ENTRY, using its unique ID code

xhr.send(null);

/*    

const req = new XMLHttpRequest();

const baseUrl = "https://myappname.bubbleapps.io/version-test/api/1.1/obj/allusers";

req.open("GET", baseUrl, true);

req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

req.send();

alert(req.responseText);

alert(req.response);

*/

}