API GET for a specific parameter

When I do a GET on https://findandreplace.bubbleapps.io/version-test/api/1.1/obj/keywords

I get:

{
    "response": {
        "results": [
            {
                "Keyword": "HeadBlade",
                "Created Date": "2018-11-13T17:26:40.515Z",
                "Created By": "1542062797913x519910176517441860",
                "Modified Date": "2018-11-21T21:11:20.844Z",
                "URL": "https://amzn.to/2FkeTem",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542129999590x332347571893174300",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Bee Bald",
                "Created Date": "2018-11-13T17:27:16.724Z",
                "Created By": "1542062797913x519910176517441860",
                "Modified Date": "2018-11-21T21:09:51.904Z",
                "URL": "https://amzn.to/2DDMQ8h",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542130035908x113779490813116420",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Gillette",
                "Created Date": "2018-11-16T22:11:09.514Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T21:10:24.140Z",
                "URL": "https://amzn.to/2qQTcc4",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542406268908x479638810847608800",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Gilette",
                "Created Date": "2018-11-16T22:11:15.726Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T21:10:06.114Z",
                "URL": "https://amzn.to/2qQTcc4",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542406275654x734567432713142300",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Gillete",
                "Created Date": "2018-11-16T22:11:23.028Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T21:10:14.208Z",
                "URL": "https://amzn.to/2qQTcc4",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542406282939x229710883143286800",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Cremo",
                "Created Date": "2018-11-16T22:12:23.033Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T21:09:58.350Z",
                "URL": "https://amzn.to/2DGOhmr",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542406342921x339651131237466100",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Schick",
                "Created Date": "2018-11-16T22:14:44.828Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T21:11:13.805Z",
                "URL": "https://amzn.to/2TkqVYn",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542406484748x196285251127083000",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Pacific Shaving",
                "Created Date": "2018-11-16T22:23:16.632Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T21:11:08.137Z",
                "URL": "https://amzn.to/2S19RFj",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542406996486x949645079454941200",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Wahl",
                "Created Date": "2018-11-16T22:25:12.728Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T21:11:03.182Z",
                "URL": "https://amzn.to/2DJEMTs",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542407112413x141818633542172670",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Oster",
                "Created Date": "2018-11-16T22:30:07.849Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T21:10:57.260Z",
                "URL": "https://amzn.to/2DoyoA2",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542407407715x471087355033026560",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "shaving cream",
                "Created Date": "2018-11-16T22:31:12.848Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T21:10:51.861Z",
                "URL": "https://amzn.to/2QMGDcT",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542407472765x724607863679877100",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "shaving oil",
                "Created Date": "2018-11-16T22:31:50.743Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T21:10:46.663Z",
                "URL": "https://amzn.to/2RYVS2G",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542407510691x878576911080489000",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Philips Norelco",
                "Created Date": "2018-11-16T23:04:58.731Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T21:10:40.360Z",
                "URL": "https://amzn.to/2KasOCH",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542409498735x334814017231257600",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Philips",
                "Created Date": "2018-11-16T23:05:10.755Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T20:30:41.123Z",
                "URL": "https://amzn.to/2KasOCH",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542409510710x947624090044989400",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Panasonic",
                "Created Date": "2018-11-16T23:41:02.058Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T20:25:59.920Z",
                "URL": "https://amzn.to/2QMRL9F",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542411662131x813934296392007700",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Dorco",
                "Created Date": "2018-11-16T23:52:55.044Z",
                "Created By": "1542322042280x724600048968568400",
                "Modified Date": "2018-11-21T20:25:50.142Z",
                "URL": "https://amzn.to/2DJ6DTN",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542412375163x742654798898397200",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Andis",
                "Created Date": "2018-11-19T19:32:04.029Z",
                "Created By": "1542584635531x858567454852163800",
                "Modified Date": "2018-11-21T20:25:31.891Z",
                "URL": "https://amzn.to/2QTMWvy?Andis",
                "websiteid": "1542831846810x186262284968394750",
                "_id": "1542655922554x890518031956967400",
                "_type": "custom.keywords"
            },
            {
                "Keyword": "Amazon",
                "Created Date": "2018-11-22T08:13:40.638Z",
                "Created By": "1542758911171x234668850898742700",
                "Modified Date": "2018-11-22T08:13:40.690Z",
                "URL": "https://www.amazon.com",
                "websiteid": "1542762115473x780057758657413100",
                "_id": "1542874418523x718228905164800000",
                "_type": "custom.keywords"
            }
        ],
        "cursor": 0,
        "count": 18,
        "remaining": 0
    }
}

How do I make an API call for just keywords that contain a specific “websiteid” so that I filter out the response?

I would assume that it’s https://findandreplace.bubbleapps.io/version-test/api/1.1/obj/keywords?websiteid=[value]

But when I enter a value it still returns all keywords.

This is the relevant part of the manual … https://bubble.io/reference#API.get_api.search_call.search_constraints

You’ll likely want to do something like

constraints = [
    {
        "key": "websiteid",
        "constraint_type": "equals",
        "value": "1542831846810x186262284968394750"
    }
]

@mishav I appreciate your response. I’ve read that manual several times and I’ve tried that, but I’m still getting all the results.

You’re probably uri-encoding too much, for example the constraints= needs the = to be raw.

Anyone know of a URL string I can use to accomplish this?

Are you sure you were getting all the rows?
From your example above I noticed that all your keyword things have the same websiteid except the last one.
So maybe that’s what makes you think you’re getting all the rows.
Try again the constraint @mishav suggested but this time use the value
1542762115473x780057758657413100
which is the only different websiteid (last item in your list).

@seanhoots Yeah, I’ve tried with both websiteids. I put the other siteid in there so I could make a call and just get 1 result back and that’s not happening.

@tyler.edwin.smith Try this for the last one:

https://findandreplace.bubbleapps.io/version-test/api/1.1/obj/keywords?constraints=[{%20"key"%3A%20"websiteid"%2C"constraint_type"%3A%20"equals"%2C"value"%3A%20"1542762115473x780057758657413100"}]

Only encode the stuff after 'constraints= ’

3 Likes

@neerja Thank you so much!! That works!

1 Like